--[[ Script By Vodkart]]--
function onUse(cid, item, fromPosition, itemEx, toPosition)
local c = {
[8091] = { -- unique id da chest
storage = 11128, -- storage
level = 250, -- level minimo
item = {{2160,1},{2152,25},{2148,50}} -- items sortiados(pode adicionar mais)
},
[8092] = { -- unique id da chest
storage = 11129, -- storage
level = 500, -- level minimo
item = {{2160,1},{2152,25},{2148,50}} -- items sortiados(pode adicionar mais)
}
}
local e = c[item.uid]
if getPlayerLevel(cid) < e.level then
return doPlayerSendCancel(cid, "Você deve ter pelo menos level ".. e.level .." para abrir a Chest.")
elseif getPlayerStorageValue(cid, e.storage) ~= -1 then
return doPlayerSendCancel(cid, "você já abriu está Chest.")
end
local rand = math.random(1, #e.item)
local itemid,amount = e.item[r][2],e.item[r][1]
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Parabéns, você rebeceu "..amount.." " .. itemid .. ".")
if isItemStackable(itemid) or amount == 1 then
doPlayerAddItem(cid, itemid, amount)
else
for i = 1, amount do
doPlayerAddItem(cid, itemid, 1)
end
end
doSendMagicEffect(getCreaturePosition(cid), math.random(28,30))
setPlayerStorageValue(cid, e.storage, 1)
return true
end