16.12.2010, 20:05
Timers do indeed have IDs, hence being able to set them to a variable. Using the function SetTimer or SetTimerEx returns the ID of the timer as an integer. As an example:
That would print:
This also confirms my original answer to the original post: it definitely starts at 1, so if(!timer) can be used.
pawn Код:
CMD:timeridtest(playerid, params[])
{
new msg[128];
new t1 = SetTimer("RandomMethod", 999999, 0);
format(msg, sizeof(msg), "t1 timerid: %i", t1);
printf(msg);
new t2 = SetTimer("RandomMethod", 999999, 0);
format(msg, sizeof(msg), "t2 timerid: %i", t2);
printf(msg);
new t3 = SetTimer("RandomMethod", 999999, 0);
format(msg, sizeof(msg), "t3 timerid: %i", t3);
printf(msg);
return 1;
}
Код:
t1 timerid: 1 t2 timerid: 2 t3 timerid: 3