ralke
(҂ ͠❛ ෴ ͡❛)ᕤ
hi, i was wondering if someone can help me with this as a request, i got this script that i used a lot on my 0.4 server and i want to have it for tfs 1.3, its a moveevent that set a timer when player stepin, when time is finished it will teleport player to a default position. also timer is reset if you stepOut and stepIn on tile again
thanks in advance!!
Lua:
local config = {
timer = 120, -- time in minutes (0.1 = 6 seconds, for easy testing)
teleport = {x = 1035, y = 1002, z = 7} -- 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, MESSAGE_STATUS_CONSOLE_BLUE, "[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
thanks in advance!!