OnPlayerUpdate or a Timer
#1

What do you think?
What should I do to update the textdraws in my gamemode?
Place them below OnPlayerUpdate.
Or make a 1 second timer?

Won't the 1 second timer give lag to my server?
Reply
#2

Depends if you really need to update your textdraws as fast as OnPlayerUpdate does.
I think you should use a timer and loop through every player with it.
Timers only lag in large quantities afaik, sounds unreasonable that 1 timer would make your server lag.

pawn Код:
forward YourFunctionName();
public YourFunctionName()
{
 for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
 {
  if(!IsPlayerConnected(playerid)) continue;  
  //Add player textdraws here
 }
 return 1;
}
Reply
#3

Any damn day, a timer. A timer would update (around approximately) every 1 second while OPU updates 5 -6 or more than that each second.
Reply
#4

Definitely timer(s), you don't need to make them update as fast as OPU executes unless youre trying to make the text draws flash or something and give your players epilepsies.
Reply
#5

Quote:
Originally Posted by Gamer_Z
Посмотреть сообщение
You know OnPlayerUpdate can get executed around 30-100 times a second for one player? I think using a timer (or even three timers and divide the workload) is less resource hogging.
I spent 15 minutes testing the frequency of OPU. Never got it above 43 (or 34, can't remember). 100 is impossible.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)