What Would be better - 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: What Would be better (
/showthread.php?tid=149180)
What Would be better -
Cem - 21.05.2010
I have a timer running every 700 milli seconds to update 4 textdraws for a vehicle's speedo, would it be faster to use onplayerupdate as in this timer of 700 milli seconds it loops through all players to check if there in vehicles speed etc.. what would be more efficent could some one reply that knows what there on about.
Re: What Would be better -
Backwardsman97 - 21.05.2010
I wouldn't use OnPlayerUpdate for something like this because it checks so fast. It wouldn't be necessary. I would have it set a timer for each player whenever they enter a vehicle.
Re: What Would be better -
Scenario - 21.05.2010
Well, what type of server do you have and what is your max alloted players?
Re: What Would be better -
shady91 - 21.05.2010
Delete..
Re: What Would be better -
Cem - 21.05.2010
Quote:
Originally Posted by Cem
I have a timer running every 700 milli seconds to update 4 textdraws for a vehicle's speedo, would it be faster to use onplayerupdate as in this timer of 700 milli seconds it loops through all players to check if there in vehicles speed etc.. what would be more efficent could some one reply that knows what there on about.
|
Would it be better to run a timer for each time a player enter's a vehicle instead of one timer always running and loops all players?
Re: What Would be better -
Backwardsman97 - 21.05.2010
That's what I would do.
Re: What Would be better -
Scenario - 21.05.2010
Quote:
Originally Posted by Cem
Quote:
Originally Posted by Cem
I have a timer running every 700 milli seconds to update 4 textdraws for a vehicle's speedo, would it be faster to use onplayerupdate as in this timer of 700 milli seconds it loops through all players to check if there in vehicles speed etc.. what would be more efficent could some one reply that knows what there on about.
|
Would it be better to run a timer for each time a player enter's a vehicle instead of one timer always running and loops all players?
|
Yes, that would be a good idea. Say your server holds... 200 people, well, maybe about 127 of them will be in a car... That isn't too bad, just make sure you don't have a timer checking each and every player! That would lag the hell out of your server.
Re: What Would be better -
Cem - 21.05.2010
Quote:
Originally Posted by Baked-Banana
That's what I would do.
|
I also have a timer running every second looping all connected players checking things like health money seconds, that's it really is there any need to make that a set timer for each player instead, also what is the max amount of timer's if anyone knows.
Re: What Would be better -
Backwardsman97 - 21.05.2010
There really isn't a max amount of timers as far as I know. It's just kind of discouraged to use too many because it can cause server lag. It just kinda depends on the amount of timers, the speed at which they get called, and what the timers are doing.