function onUse(cid, item, fp, itemEx, toPosition)
local posi = { [{x = fp.x, y = fp.y + 1, z = fp.z}] = {x = fp.x, y = fp.y - 1, z = fp.z},
[{x = fp.x, y = fp.y - 1, z = fp.z}] = {x = fp.x, y = fp.y + 1, z = fp.z},
[{x = fp.x - 1, y = fp.y, z = fp.z}] = {x = fp.x + 1, y = fp.y, z = fp.z},
[{x = fp.x + 1, y = fp.y, z = fp.z}] = {x = fp.x - 1, y = fp.y, z = fp.z},
}
local trainerTile = 407
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
for posout, pos in pairs(posi) do
if getTileItemById(pos, trainerTile).itemid == trainerTile then
if getTopCreature(pos).uid == cid then
doTeleportThing(cid, posout)
return true
end
if isCreature(getTopCreature(pos).uid) then
doPlayerSendCancel(cid, "Esse trainer esta ocupado.")
doSendMagicEffect(toPosition, CONST_ME_POFF)
else
doTeleportThing(cid, pos)
break
end
end
end
return true
end
<action actionid="1234" event="script" value="arquivo.lua"/>
Só precisa mudar a variável trainerTile, pro id do tile que fica dentro do trainer.
actionid coloca na alavanca.