SetTimerEx
From SA-MP Wiki
SetTimerEx
Sets a timer to call a function after some time. This variant can pass parameters to the function.
(funcname[], interval, repeating, const format[], {Float,_}:...)
| funcname[] | Name of the function to call. |
| interval | Inverval in milliseconds. |
| repeating | Boolean if the timer should oocur repeatedly or only once |
| format[] | Special format indicating the types of values the timer will carry |
| {Float,_}:... | Indefinite number of arguments to pass |
| Returns | The ID of the timer that was started. |
Format Strings
| Placeholder | Meaning |
|---|---|
| %b | Inserts a number at this position in binary radix |
| %c | Inserts a single character. |
| %d | Inserts an integer (whole) number |
| %f | Inserts a floating point number. |
| %i | Inserts an integer. |
| %s | Inserts a string. |
| %x | Inserts a number in hexadecimal notation. |
| %% | Inserts the literal '%' |
The values for the placeholders follow in the exact same order as parameters in the call.
You may optionally put a number between the '%' and the letter of the placeholder code. This number indicates the field width; if the size of the parameter to print at the position of the placeholder is smaller than the field width, the field is expanded with spaces.
forward message(second, msg[]); public OnGameModeInit() { print("Starting timer..."); SetTimerEx("message", 1000, false, "is", 1337, "hello!"); } public message(second, msg[]) { printf("%i second has passed, also we have a message: %s", second, msg); return 1; }
Related Functions
The following functions might be useful as well, as they're related to this function in one way or another.
- SetTimer: Set a timer.
- KillTimer: Stop a timer.
