What's better: per-player timers or a global timer? - 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: What's better: per-player timers or a global timer? (
/showthread.php?tid=592720)
What's better: per-player timers or a global timer? -
Aerotactics - 29.10.2015
What I mean is, Which is better?
Код:
public Timer()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
SetPlayerHealth(i,100);
}
}
OR
Код:
public Timer(playerid)
{
SetPlayerHealth(playerid,100);
}
Keep in mind both timers are doing the same thing, per se.
Re: What's better: per-player timers or a global timer? -
Gammix - 29.10.2015
Per player timers.
Actually depends on what you want to do and in how much interval. Frequent ones should always be per player.
Re: What's better: per-player timers or a global timer? -
DobbysGamertag - 29.10.2015
Depends entirely on what you need timers for. Instead of timers for setting health to 100, why don't you use
https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage
https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage
https://sampwiki.blast.hk/wiki/OnPlayerWeaponShot
Some things can be done without timers.
Re: What's better: per-player timers or a global timer? -
Aerotactics - 29.10.2015
Quote:
Originally Posted by DobbysGamertag
|
Of course, I was just using it as an example.
To elaborate: If I want to do the same thing to all players, should I use a per player timer or a global timer, and why?