local items = { --[[id = id do item, count = quantidade, chance = chance ]]--
[1] = {id = 7735, count = 1, chance = 2},
[2] = {id = 7735, count = 1, chance = 5},
[3] = {id = 7735, count = 1, chance = 10},
[4] = {id = 7735, count = 1, chance = 100}
}
local storage = 123 -- storage
local time = 60 -- tempo em minutos.
function onUse(cid, item, fromPos, itemEx, toPos)
if getPlayerStorageValue(cid, storage) - os.time() <= 0 then
for i = 1, #items do
if (items.chance > math.random(1, 100)) then
doPlayerAddItem(cid, items.id, items.count)
doPlayerSendCancel(cid, "Você Ganho! O Item "..getItemNameById(items.id).."!")
else
doPlayerSendCancel(cid, "Você não ganhou nada, volte em 1 hora.")
end
setPlayerStorageValue(cid, storage, os.time()+time*1*60)
end
else
doPlayerSendCancel(cid, "Você só pode pegar sua recompensa a cada 1 hora.")
end
return true
end