SA-MP Forums Archive
Question about couple 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Question about couple timers (/showthread.php?tid=221347)



Question about couple timers - OldDirtyBastard - 05.02.2011

Would this be actualy wise to use?

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(!zareaupdate) zareaupdate = SetTimer("update_zarea",1000,4);
    if(!zoneupdate) zoneupdate = SetTimer("update_zones",1000,4);
    return 1;
}
Or it would be better to place the timers at OnGameModeInit?

The same question i have for a ping kicker, would it be better to use it
at OnPlayerUpdate or better set a timer that checks the ping?
I need to some advices from good scripters.
Thanks, regards.


Re: Question about couple timers - xRyder - 05.02.2011

That code you posted - you should put it under OnGameModeInIt. Why? Because I think you use it as a global timer to update zones. If you put it under OnPlayerSpawn this will only work if players spawns, and only then timer will start - and then for every player who connects (you can find it buggy).

For the ping kicker. I think you should use a timer, 'cause OnPlayerUpdate is called pretty often, so you don't need it, since players ping is updated every few seconds.
(I might be wrong.)


Re: Question about couple timers - MadeMan - 05.02.2011

I would put both to OnGameModeInit.


Re: Question about couple timers - OldDirtyBastard - 05.02.2011

Alright thank you both.