Something is worng with this script, because the players can take infinite of times the reward.
Can someone check it?
Can someone check it?
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local outPos = {x=33270, y=32446, z=12}
local chest = {
rewards = {
[36204] = 7730,
},
storageId = 36205
}
if chest.rewards[item.uid] ~= nil then
if getPlayerStorageValue(cid, chest.storageId) == -1 then
doPlayerSendTextMessage(cid,25,"You have found a ".. getItemNameById(chest.rewards[item.uid]) ..".")
doPlayerAddItem(cid, chest.rewards[item.uid], 1)
doPlayerAddItem(cid, 2152, 50)
doTeleportThing(cid, newPos, TRUE)
setPlayerStorageValue(cid, chest.storageId, 1)
else
doPlayerSendTextMessage(cid,25,"It is empty.")
end
end
return true
end