- Dokumentacja
- Funkcje wspólne
- resetTimer
Funkcja
resetTimer
Odlicza interwał timera od nowa, od tej chwili.
Składnia
bool resetTimer(timer timer)Argumenty
timertimer- Timer.
Zwraca
true przy powodzeniu.
Przykład
Wyrzuca gracza po 5 minutach bezczynności; każda wiadomość odlicza od nowa.
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)