local tempo = 180 * 1000 -- em ms, 180 * 1000 = 3 min
local area1 = {x = 126, y = 46, z = 1} -- Ponta de cima na esquerda na area
local area2 = {x = 128, y = 50, z = 1} -- Ponta de baixo na direita na area
local teleportar_para = {x = 1, y = 1, z = 1} -- onde o player irá após o tempo acabar
local function doMovePlayerBack(cid)
scriptTiming[cid] = nil
if not isCreature(cid) then return end
if not isInArea(getThingPos(cid), area1, area2) then return end
doTeleportThing(cid, teleportar_para, false)
if getThingPos(cid).x ~= teleportar_para.x or getThingPos(cid).y ~= teleportar_para.y then
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false)
end
end
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if scriptTiming[cid] then
stopEvent(scriptTiming[cid])
scriptTiming[cid] = nil
end
scriptTiming[cid] = addEvent(doMovePlayerBack, tempo, cid)
end
local scriptTiming = {} -- não modifique
local function isInArea(a, b, c)
return a.x >= b.x and a.x <= c.x and a.y >= b.y and a.y <= c.y and a.z == b.z and a.z == c.z
end