Simple Question
#6

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:

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;
}
That would print:
Код:
t1 timerid: 1
t2 timerid: 2
t3 timerid: 3
This also confirms my original answer to the original post: it definitely starts at 1, so if(!timer) can be used.
Reply


Messages In This Thread
Simple Question - by DeadAhead - 16.12.2010, 19:52
Re: Simple Question - by Ash. - 16.12.2010, 19:54
Re: Simple Question - by Benjo - 16.12.2010, 19:59
Re: Simple Question - by Retardedwolf - 16.12.2010, 19:59
Re: Simple Question - by Scenario - 16.12.2010, 20:00
Re: Simple Question - by Benjo - 16.12.2010, 20:05

Forum Jump:


Users browsing this thread: 2 Guest(s)