function onUse(cid, item, frompos, item2, topos)
local prize = item.uid
local name = getItemNameById(prize)
local count = item.actionid/100
if prize > 0 and prize < 10000 then
queststatus = getPlayerStorageValue(cid,prize)
if queststatus == -1 then
if count > 1 then
doPlayerSendTextMessage(cid,24,'You have found '.. count ..' ' .. name .. 's.')
doPlayerAddItem(cid,prize,count)
setPlayerStorageValue(cid,prize,1)
else
doPlayerSendTextMessage(cid,24,'You have found ' .. name .. '.')
doPlayerAddItem(cid,prize,1)
setPlayerStorageValue(cid,prize,1)
end
else
doPlayerSendTextMessage(cid,24,'The chest is empty.')
end
return 1
else
return 0
end
end