03.07.2016, 18:30
Alright.
There is 2 types of timer in SA:MP.
- SetTimer(funcname[], interval, repeating)
- SetTimerEx(funcname[], interval, repeating, const format[], {Float,_}:...)
The difference between those timers is one can't take parameters (the first).
How does this works?
Let's respawn a player in 10 seconds after do /respawn.
Copy and paste in your gamemode to see the comments.
There is 2 types of timer in SA:MP.
- SetTimer(funcname[], interval, repeating)
- SetTimerEx(funcname[], interval, repeating, const format[], {Float,_}:...)
The difference between those timers is one can't take parameters (the first).
How does this works?
Let's respawn a player in 10 seconds after do /respawn.
Copy and paste in your gamemode to see the comments.
PHP Code:
// Code ...
SetTimerEx("RespawnPlayer", 10000, false, "i", playerid);
// ^ The name of the function which timer wille execute after x seconds.
// ^ Time before the timer execut the function
// ^ If we want to repeat this (execute a function after x seconds, usefull for anti-cheat checking)
// ^ Our function called RespawnPlayer have 1 parameter : playerid and playerid is an integer so "i"
// ^ To complete the "i"
public RespawnPlayer(playerid)
{
SpawnPlayer(playerid);
return 1;
}