Difference between revisions of "ResetTimer"

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(OOP syntax added)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Needs_Checking|Is this really only server side?}}
{{Server client function}}
{{Server function}}
__NOTOC__
__NOTOC__
This function allows you to reset the elapsed time in existing timers to zero. The function does not reset the 'times to execute' count on timers which have a limited amout of repetitions.
This function allows you to reset the elapsed time in existing timers to zero. The function does not reset the 'times to execute' count on timers which have a limited amout of repetitions.
Line 8: Line 7:
bool resetTimer ( timer theTimer )
bool resetTimer ( timer theTimer )
</syntaxhighlight>  
</syntaxhighlight>  
 
{{OOP||[[timer]]:reset||}}
===Required Arguments===  
===Required Arguments===  
*'''theTimer:''' The [[timer]] whose elapsed time you wish to reset.
*'''theTimer:''' The [[timer]] whose elapsed time you wish to reset.
Line 17: Line 16:
==Example==  
==Example==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--TODO
local timer = setTimer(example,3000,1)
 
function example()
  outputChatBox("3 seconds has passed.")
  resetTimer(timer)
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Utility functions}}
{{Utility functions}}
[[Category:Needs_Example]]

Latest revision as of 07:02, 12 July 2014

This function allows you to reset the elapsed time in existing timers to zero. The function does not reset the 'times to execute' count on timers which have a limited amout of repetitions.

Syntax

bool resetTimer ( timer theTimer )

OOP Syntax Help! I don't understand this!

Method: timer:reset(...)

Required Arguments

  • theTimer: The timer whose elapsed time you wish to reset.

Returns

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

Example

local timer = setTimer(example,3000,1)

function example()
   outputChatBox("3 seconds has passed.")
   resetTimer(timer)
end

See Also