local config = {
timer = 0.1, -- time in minutes (0.1 = 6 seconds, for easy testing)
teleport = {x = 11111, y = 11111, z = 11} -- teleport position
}
kick_player = {}
local function kickPlayer(cid)
if not isPlayer(cid) then
return true
end
doTeleportThing(cid, config.teleport)
addEvent(doRemoveCreature, 0, cid)
return true
end
local function stopKick(cid)
if stopEvent(kick_player[cid]) then
if not isPlayer(cid) then
return true
end
doPlayerSendTextMessage(cid, 23, "You will no longer be forcibly logged out.")
end
return true
end
function onStepIn(cid, item, position, fromPosition)
if not isPlayer(cid) then
return false
end
kick_player[cid] = addEvent(kickPlayer, config.timer * 60 * 1000, cid)
doPlayerSendTextMessage(cid, 22, "[Trainer]: If you remain on this tile longer then " .. config.timer .. " minutes, the system will automatically log you out.")
return true
end
function onStepOut(cid, item, position, fromPosition)
if not isPlayer(cid) then
return false
end
addEvent(stopKick, 0, cid)
return true
end