ve se é isso,
function onUse(cid, item, frompos, item2, topos)
local tpId = 1387
local p = getCreaturePosition(cid)
local tps = {
pos = {x=p.x, y=p.y, z=p.z},
toPos = {x=32360, y=32360, z=7},
time = 15, -- remove teleport
exausted = 60, -- in seconds
storage1 = 18370, -- dont edit
storage2 = 97854 -- dont edit
}
function removeTp()
local t = getTileItemById(tps.pos, tpId)
if t then
doRemoveItem(t.uid, 1)
doSendMagicEffect(tps.pos, CONST_ME_POFF)
end
end
function doTPSecond(cid,delay)
local seconds = math.floor((getPlayerStorageValue(cid, tps.storage1) - os.time()))
local msg = ''.. (seconds < 0 and 0 or seconds) ..''
doSendAnimatedText(tps.pos, msg, math.random(1,140))
if delay ~= 1 then
addEvent(doTPSecond, 1000,cid, delay -1)
end
end
if getCreatureCondition(cid, CONDITION_INFIGHT) then
return true,doPlayerSendTextMessage(cid,22,"Sorry,you cannot use this item with battle.")
elseif (getPlayerStorageValue(cid, tps.storage2) >= os.time()) then
return true,doPlayerSendCancel(cid, "wait " .. getPlayerStorageValue(cid, tps.storage2) - os.time() .. " seconds to use this item again.")
end
doCreateTeleport(tpId, tps.toPos, tps.pos)
setPlayerStorageValue(cid, tps.storage1, os.time()+tps.time)
doTPSecond(cid, tps.time)
addEvent(removeTp, tps.time*1000)
setPlayerStorageValue(cid,tps.storage2,os.time()+tps.exausted)
doRemoveItem(item.uid, 1)
return false
end
obs: Fiz uma function que fica aparecendo em cima do teleport qntos segundos faltam pra ele fechar