KillTimer: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 14: Line 14:


==Example==  
==Example==  
'''Example 1:'' This example will kill an existing timer.
This example creates a timer then destroys it straight away.
 
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
timer = setTimer ( "delayedChat", 1000, 1, "Hello, World!" )
myTimer = setTimer ( "delayedChat", 1000, 1, "Hello, World!" )
killTimer ( timer )
killTimer ( myTimer )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Utility functions}}
{{Utility functions}}

Revision as of 18:39, 5 June 2006

This function allows you to kill/halt existing timers, by passing a timerID as a parameter.

Syntax

bool killTimer ( int timerID )

Required Arguments

  • timerID: The timer you wish to halt.

Returns

Returns true if a timer was successfully killed, false if no timer with the ID provided existed.

Example

This example creates a timer then destroys it straight away.

myTimer = setTimer ( "delayedChat", 1000, 1, "Hello, World!" )
killTimer ( myTimer )

See Also