@MalBack vou considerar que está usando TFS 1.3
Troca o X, Y e Z
<action actionid="45001" event="script" value="teleportar.lua"/>
teleportar.lua:
local destination = Position(X, Y, Z)
local cooldown_time = 30 -- em minutos
local last_use = {}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)
if not player then
return false
end
-- Verificar se passou o tempo do cooldown_time
if last_use[cid] and os.time() - last_use[cid] < cooldown_time * 60 then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You must wait " .. cooldown_time .. " minutes before using this again.")
return true
end
-- verificar se o player deu use no tile ou item correto
if item and item.itemid ~= 0 then
-- player deu use em um item
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot use this with an item.")
return true
end
local tile = Tile(toPosition)
if not tile or not tile:getItemById(0) then
-- player deu use em um item que não existe ou em um tile vazio
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You must use this on a tile.")
return true
end
-- teleport player and update last_use
player:teleportTo(destination, true)
last_use[cid] = os.time()
return true
end