What's better: per-player timers or a global timer?
#1

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.
Reply
#2

Per player timers.

Actually depends on what you want to do and in how much interval. Frequent ones should always be per player.
Reply
#3

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.
Reply
#4

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
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.
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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)