• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

[REQUEST] TP from tile after X time

MeNi

*^#%$%
Joined
Jul 23, 2008
Messages
183
Reaction score
12
Hi, i request a script, which kick (TP to 1000/1000/7) player, after standing for example 10 minutes on tile.

How it should work:

12:00 - player enter tile
12:10 - if player didn't left tile, he got TP to temple. If he already left, nothing happens.
 
I think that, what he wants is a GlobalEvent on which it will check for players that are Idle for X amount of time then if the player is Idle for
that X amount of time the it will teleport them back to their respective temple.
 
Code:
local event = {}
local pos = {x=1000, y=1000, z=7}

local function teleport(cid)
	doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
	doTeleportThing(cid, pos)
	doSendMagicEffect(pos, CONST_ME_TELEPORT)
	event[cid] = nil
end

function onStepIn(cid, item, position, fromPosition)
	event[cid] = addEvent(teleport, 10 * 60 * 1000, cid)
end

function onStepOut(cid, item, position, fromPosition)
	if event[cid] then
		stopEvent(event[cid])
		event[cid] = nil
	end
end
 
Back
Top