About y_timers
#1

Hello guys, i have a question about y_timers.

I just try to finished a job system but I have a little problem, for 1 month I use y_timers and I don't know how can i define a timer that repet every 1 second, for example i have something like this:

Код:
jobsystem[playerid] = SetTimerEx("ProgressJob", 1000, 1, "i", playerid); // this timer will be called in every 1 second for a playerid
Now, how can i do for y_timers, i try something below but it's called once and after is stop..

Код:
new Timer:jobsystem[MAX_PLAYERS];
jobsystem[playerid] = defer ProgressJob(playerid);

timer ProgressJob[1000](playerid)
{
     //my code
}
If someone can help me with this post here, thanks!
Reply
#2

if i remember well, use repeat instead defer
Reply
#3

Quote:
Originally Posted by m4karow
Посмотреть сообщение
if i remember well, use repeat instead defer
Yes and use "stop" to stop the timer.

repeat
This calls the timer repeatedly after the delay defined on the timer. This is similar to tasks but you can stop the timer again:

Код:
main()
{
    repeat DelayedFunction(42);
    new
        Timer:x = repeat DelayedFunction(42);
    stop x;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)