A question about y_timers
#1

I want to do a global timer, but i don't know how to use y_timers, for now i'm using SetTimerEx and Public function, but i want to change.

I want to be constantly called (every 1 second)

I have this in my gamemode:
Code:
OnGameModeInit:
global_timer = SetTimer("timerglobal", 1000, 1);

GameModeExitFunc:
KillTimer(unjailtimer);

////

forward timerglobal
public timerglobal()
{
....
return 1;
}
And i changed like this:
Code:
OnGameModeInit:
defer global_timer();

GameModeExitFunc:
stop global_timer();

////

task global_timer[1000]()
{
....
}
Is it ok how did I replace or something is wrong?
Reply
#2

Task is different than timer. It runs always, no need to start it manually with defer (alto this means you can't stop it). If you are doing a loop of players in your global_timer, then ptask is right for you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)