SetTimer

From SA-MP Wiki

Jump to: navigation, search

SetTimer


Sets a timer to call a function after some time.


Parameters:
(funcname[], interval, repeating)
funcname[]Name of the function to call as a string. Needs to be a public!
intervalInverval in milliseconds.
repeatingBoolean if the timer should occur repeatedly or only once


ReturnsThe ID of the timer that was started


Important Note: The function that should be called, must be public. The means it has to be forwarded as well.


forward message();
 
public OnGameModeInit( )
{
    print("Starting timer...");
    SetTimer("message",1000,false);
}
 
public message()
{
    print("1 second has passed.");
}

Related Functions

The following functions might be useful as well, as they're related to this function in one way or another.

Personal tools
In other languages