botar pra cobrar item ao puxar a alavanca
item: 2157 / quantidade 80
Citarlocal config = {
daily = "yes", -- allow only one enter per day? (like in global Tibia)
level = 500,
storage = 30015,
entry =
{
{x = 319, y = 669, z = 7},
{x = 319, y = 668, z = 7},
{x = 319, y = 667, z = 7},
{x = 319, y = 666, z = 7}
},
destination =
{
{x = 276, y = 653, z = 7},
{x = 276, y = 653, z = 7},
{x = 276, y = 653, z = 7},
{x = 276, y = 653, z = 7}
}
}config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1946) then
if(config.daily) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
else
doTransformItem(item.uid, item.itemid - 1)
endreturn true
endif(item.itemid ~= 1945) then
return true
endlocal players = {}
for _, position in ipairs(config.entry) do
local pid = getTopCreature(position).uid
if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
endtable.insert(players, pid)
endfor i, pid in ipairs(players) do
doSendMagicEffect(config.entry[i], CONST_ME_POFF)
doTeleportThing(pid, config.destination[i], false)
doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
enddoTransformItem(item.uid, item.itemid + 1)
return true
end