resetTimer | Multi Theft Auto: Wiki Skip to content

resetTimer

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function allows you to reset the value of the elapsed time in existing timers. The function resets the "execution time" value for timers with a limited number of repetitions.

OOP Syntax Help! I don't understand this!

  • Method: timer:reset(...)

Syntax

bool resetTimer ( timer theTimer )
Required Arguments
  • theTimer: The timer whose elapsed time you wish to reset.

Returns

  • bool: value

Returns true if the timer was successfully reset, false otherwise.

Code Examples

shared
-- This example shows how you can reset timer by using /rtimer command.
local timerElement = false
function timerFunction()
print("Timer function executed at "..getTickCount())
end
timerElement = setTimer(timerFunction, 3000, 0)
function timerResetCommand()
local validTimer = isTimer(timerElement)
if validTimer then
print("Timer has been resetted.")
resetTimer(timerElement)
end
end
addCommandHandler("rtimer", timerResetCommand)