teria como fazer se o player sair do tile antes de ser teleportado o tempo pare de contar, e se ele entrar de volta no tile comece a contar do 0.
Tem como fazer isso?
local events ={}local tempo = 30 -- tempo em segundos
local pos = {x = 1, y = 1, z = 1}
local function doTeleportThingNoError(guid, pos)
local cid = getPlayerByGUID(guid)
if not isCreature(cid) then return end
doTeleportThing(cid, pos)
end
function onStepIn(cid, item, oldPos)
doPlayerSendTextMessage(cid, 27, "Contagem iniciada, daqui " .. tempo .. " segundos você será teleportado")
events[getPlayerGUID(cid)] = addEvent(doTeleportThingNoError, tempo * 1000, getPlayerGUID(cid), pos)
return true
end
function onStepOut(cid, item, pos)
doPlayerSendTextMessage(cid, 28, "Contagem zerada.")
stopEvent(events[getPlayerGUID(cid)])
events[getPlayerGUID(cid)] = nil
return true
end