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

TFS 1.X+ Movement Teleport Exhaustion

myalitth

New Member
Joined
Jan 13, 2013
Messages
69
Reaction score
3
Someone know how to add exhaustion on a movement teleport?
Like 2 seconds per action to prevent memory leak.

TFS 1.3+
 
Solution
Lua:
--outside function
local exhaustion = {}


--inside function
local playerId = player:getId()
local currentTime = os.mtime()
if exhaustion[playerId] and exhaustion[playerId] > currentTime then
    -- do nothing, or tell player they are exhausted
    -- maybe teleport them to previous tile?
    return false
end
exhaustion[playerId] = currentTime + 2000 -- 2000 milliseconds
Lua:
--outside function
local exhaustion = {}


--inside function
local playerId = player:getId()
local currentTime = os.mtime()
if exhaustion[playerId] and exhaustion[playerId] > currentTime then
    -- do nothing, or tell player they are exhausted
    -- maybe teleport them to previous tile?
    return false
end
exhaustion[playerId] = currentTime + 2000 -- 2000 milliseconds
 
Solution
Back
Top