- Documentation
- Shared functions
- resetTimer
Function
resetTimer
Restarts counting the timer's interval from this moment.
Syntax
bool resetTimer(timer timer)Arguments
timertimer- The timer.
Returns
true on success.
Example
Kicks a player after 5 minutes of inactivity; every message restarts the count.
local afk = {}
addEventHandler("onPlayerJoin", root, function()
local player = source
afk[player] = setTimer(function() kickPlayer(player, "AFK") end, 300000, 1)
end)
addEventHandler("onPlayerChat", root, function()
if isTimer(afk[source]) then resetTimer(afk[source]) end
end)
addEventHandler("onPlayerQuit", root, function()
if isTimer(afk[source]) then killTimer(afk[source]) end
afk[source] = nil
end)