• 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!

request: Tile - teleport after x minutes

Michael Orsino

Premium User
Premium User
Support Team
Joined
Nov 15, 2007
Messages
854
Solutions
10
Reaction score
389
Location
Santiago, Chile (Australian)
Basically I am looking for a script that I can assign to a tile that will teleport the player to a destination after x minutes.

So it would work something like this -
Code:
<action uniqueid="12345" script="teleportback.lua" />

If UID 12345 was assigned to a random tile, after x minutes the player on this tile is teleported to a destination.

I tried searching and did not find what I was looking for.
 
Code:
local toPos = {x=125, y=75, z=7}
local time = 60 --in seconds (1 minute)
local pPos = getCreaturePosition(cid)

function onStepIn(cid, item, position, fromPosition)

if item.uid == 12345 then

	addEvent(teleportPlayer, (1000*time))

	end
end

function teleportPlayer()

	doSendMagicEffect(pPos, CONST_ME_POFF)
	doTeleportThing(cid, toPosition)
	doSendMagicEffect(toPos, CONST_ME_TELEPORT)
end
 
Time defined by minutes.
PHP:
local config = {
     timeToTeleport = 5, -- in minutes
     posToTeleportTo = { x = 100 , y = 100 , z = 7 }
}

onStepIn(cid, item, position)
     addEvent(doSendMagicEffect, 1000 * 60 * config.timeToTeleport, getCreaturePosition(cid), 2)
     addEvent(doTeleportThing, 1000 * 60 * config.timeToTeleport, cid, config.posToTeleportTo)
     addEvent(doSendMagicEffect, 1000 * 60 * config.timeToTeleport, getCreaturePosition(cid), 12)
     return TRUE
end
Time defined by seconds.
PHP:
local config = {
     timeToTeleport = 25, -- in seconds
     posToTeleportTo = { x = 100 , y = 100 , z = 7 }
}

onStepIn(cid, item, position)
     addEvent(doSendMagicEffect, 1000 * config.timeToTeleport, getCreaturePosition(cid), 2)
     addEvent(doTeleportThing, 1000 * config.timeToTeleport, cid, config.posToTeleportTo)
     addEvent(doSendMagicEffect, 1000 * config.timeToTeleport, getCreaturePosition(cid), 12)
     return TRUE
end
 
Back
Top