30.07.2013, 18:29
pawn Код:
SetTimer("HideTextDraw",8500,1);
and also how do I kill that timer...
SetTimer("HideTextDraw",8500,1);
new connect_timer[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
print("Starting timer...");
connect_timer[playerid] = SetTimerEx("WelcomeTimer", 5000, true, "i", playerid);
return 1;
}
public OnPlayerDisconnect(playerid)
{
KillTimer(connect_timer[playerid]);
return 1;
}
forward WelcomeTimer(playerid);
public WelcomeTimer(playerid)
{
SendClientMessage(playerid, -1, "Welcome!");
}
KillTimer(timerid)
SetTimer(funcname[], interval, repeating) funcname[] Name of the function to call as a string. Needs to be a public! interval Interval in milliseconds. repeating Boolean if the timer should occur repeatedly or only once |
new TIMER_HideTextDraw;
SomeFunction()
{
TIMER_HideTextDraw = SetTimer("HideTextDraw",8500,1);
}
// To kill it:
KillTimer(TIMER_HideTextDraw);
To kill a timer you have to pass it's ID to KillTimer(). This ID is returned by SetTimer(Ex), so you need to store it in a variable (or an array).
pawn Код:
EDIT: CrazyChoco has a better example using an array. |