SA-MP Forums Archive
About y_timers - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: About y_timers (/showthread.php?tid=642513)



About y_timers - None1337 - 01.10.2017

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!


Re: About y_timers - m4karow - 01.10.2017

if i remember well, use repeat instead defer


Re: About y_timers - Dayrion - 01.10.2017

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;
}