@mister17 havia entendido outra coisa:
-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
local config = {
--- [ID DA ORB] = {ID DAS STONES, QUANTIDADE{minimo, maximo},
[10542] = {fruit = 11441, quantity = {0, 1}, CommomM = {2132, 175}},
[10543] = {fruit = 11442, quantity = {0, 1}, CommomM = {2132, 175}},
[10544] = {fruit = 11443, quantity = {0, 1}, CommomM = {2132, 175}},
}
local tempo = 600 -- tempo em segundos
local tempoVip = 300
local stoTempo = 8120
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, stoTempo) >= os.time() then
doPlayerSendTextMessage(cid, 27, "You have to wait "..(getPlayerStorageValue(cid, stoTempo) - os.time()).." seconds to use this item again.")
return false
end
if getPlayerItemCount(cid, config[item.itemid].CommomM[1]) < config[item.itemid].CommomM[2] then
doPlayerSendTextMessage(cid, 27, "Você nao possui os materiais necessários!")
return false
end
if config[item.itemid] then
local randomWin = math.random(config[item.itemid].quantity[1],config[item.itemid].quantity[2])
if randomWin > 0 then
doPlayerAddItem(cid, config[item.itemid].fruit, randomWin)
doPlayerSendTextMessage(cid, 27, "Parabéns! O processo de transformaçao foi realizado com sucesso, assim se transformando em "..getItemNameById(config[item.itemid].fruit)..".")
else
doPlayerSendTextMessage(cid, 27, "A orb quebrou durante o processo!")
end
doRemoveItem(item.uid, 1)
doPlayerRemoveItem(cid, config[item.itemid].CommomM[1], config[item.itemid].CommomM[2])
if isPremium(cid) then
setPlayerStorageValue(cid, stoTempo, os.time() + tempoVip)
else
setPlayerStorageValue(cid, stoTempo, os.time() + tempo)
end
end
return true
end