[COLOR="#008000"]local config = {
storage = 21100,
delay = 1000,
teleportPos = {x = 984, y = 431, z = 8},
teleportMsg = "You have been standing still staring too long."
}[/COLOR]
local function scheduleTeleport(cid)
if isPlayer(cid) then
setPlayerStorageValue(cid, config.storage, -1)
doCreatureSay(cid, config.teleportMsg, TALKTYPE_ORANGE_1)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doTeleportThing(cid, config.teleportPos, FALSE)
doSendMagicEffect(config.teleportPos, CONST_ME_TELEPORT)
end
end
function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) then
setPlayerStorageValue(cid, config.storage, addEvent(scheduleTeleport, config.delay, cid))
end
return TRUE
end
function onStepOut(cid, item, position, fromPosition)
if isPlayer(cid) then
local eventId = getPlayerStorageValue(cid, config.storage)
if eventId ~= -1 then
stopEvent(eventId)
setPlayerStorageValue(cid, config.value, -1)
end
end
return TRUE
end