• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Help

samuelsami

New Member
Joined
Oct 27, 2010
Messages
77
Reaction score
1
Sup otland! Well i made this script by myself but i'm not good scripter.... The problem is i can get infinite items and i just want 1 item, like in annihilator, help please

function onUse(cid, item, fromPosition, itemEx, toPosition)

if item.uid == 5005 then
queststatus = getPlayerStorageValue(cid,5027)
if queststatus == -1 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found your reward.")
doPlayerAddItem(cid,8906,1)
setPlayerStorageValue(cid,5410,1)
else
doPlayerSendTextMessage(cid,22,"It is empty.")
end
elseif item.uid == 5005 then
queststatus = getPlayerStorageValue(cid,5027)
if queststatus == -1 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found your reward.")
doPlayerAddItem(cid,8908,1)
setPlayerStorageValue(cid,5410,1)
else
doPlayerSendTextMessage(cid,22,"It is empty.")
end

else
return 0
end

return 1
end

- - - Updated - - -

Close this, i know the answer now
 
Code:
setPlayerStorageValue(cid,5410,1)
and
Code:
queststatus = getPlayerStorageValue(cid,5027)

should have same storage ids else it will check for 5027 and the quest wont add that id so u can take it over and over again.
 
Or, you can go into map editor, and set all the items in there, set the action id 2000, and the unique all the same for the chests... then put the item inside the chest... If it doesn't work automatically..

Set the chests ActionId to the quest storage, then add this script to your actions.
Set the Unique of chest to 0, and put the item you want to give in the first slot.

Lua:
local chest = {1111,2222,3333,4444} -- This is chest direction, set all chest looktypes of the chest you use. -- 
local questStorage = 5027

function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == chest then
if item.aid == questStorage then 
   if getPlayerStorageValue(cid, questStorage) ~= 1 then
     setStorageValue(cid, questStorage, 1)
     doPlayerAddItem(cid, getContainerItem(item.uid, 1), 1)
else
   doPlayerSendCancel(cid, "You have already completed this quest!")
return false
end

btw wrap lua textin in [.lua] [./lua] and code in [.code] [./code] without periods.


-- i know he solved, this is for anyone that might have the problem. --
 
Last edited:
Back
Top