function onUse(cid, item, fromPosition, itemEx, toPosition)
if (getPlayerStorageValue(cid, 987979) >= os.time()) then
doPlayerSendCancel(cid, "Aguarde "..(getPlayerStorageValue(cid, 987979) - os.time()).." segundos para usar esse item novamente.")
doSendMagicEffect(getCreaturePosition(cid),CONST_ME_POFF)
return true
end
local foodID = {2672} -- IDs da comida que o jogador irá receber
local food_final = foodID[math.random(#foodID)]
if getPlayerFreeCap(cid) >= getItemWeightById(food_final) then
if doPlayerAddItem(cid, food_final, 1, false) then
doSendAnimatedText(getCreaturePosition(cid), 'FOOD!', math.random(255))
setPlayerStorageValue(cid,987979,os.time()+10) -- Tempo de Espera 10 segundos
doSendMagicEffect(getPlayerPosition(cid), 35)
else
doCreatureSay(cid, "Você não tem espaço suficiente!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getPlayerPosition(cid), 2)
end
else
doCreatureSay(cid, "É muito pesado libera sua cap!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getPlayerPosition(cid), 2)
end
return true
end