local config = {
level = 100,
entry =
{
{x = 9854, y = 10405, z = 12},
{x = 9855, y = 10405, z = 12},
{x = 9856, y = 10405, z = 12},
{x = 9857, y = 10405, z = 12},
{x = 9858, y = 10405, z = 12},
{x = 9859, y = 10405, z = 12},
{x = 9860, y = 10405, z = 12},
{x = 9861, y = 10405, z = 12}
},
destination =
{
{x = 9855, y = 10377, z = 12},
{x = 9856, y = 10377, z = 12},
{x = 9857, y = 10377, z = 12},
{x = 9858, y = 10377, z = 12},
{x = 9859, y = 10377, z = 12},
{x = 9860, y = 10377, z = 12},
{x = 9861, y = 10377, z = 12},
{x = 9862, y = 10377, z = 12}
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1946) then
doTransformItem(item.uid, item.itemid - 1)
return true
end
if(item.itemid ~= 1945) then
return true
end
local 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
end
table.insert(players, pid)
end
for 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)
end
doTransformItem(item.uid, item.itemid + 1)
return true
end