Question about vehicle speedometer. -
Universal - 20.12.2011
Hey everyone, I am curious about this one little question: Is it better to make a Timer, which will calculate your speed and update the string, or add this code under the
OnPlayerUpdate ? In this way, I will need no timer. Will this improve the performance, or not? Because, its more accurate than the timer.
Re: Question about vehicle speedometer. -
Jochemd - 20.12.2011
I think a timer would be fine. OnPlayerUpdate is called for everything you do, not only a vehicle update - run a 1-second timer instead.
Re: Question about vehicle speedometer. -
Universal - 20.12.2011
Quote:
Originally Posted by Jochemd
I think a timer would be fine. OnPlayerUpdate is called for everything you do, not only a vehicle update - run a 1-second timer instead.
|
Hmm... Alright, but what if I would do this check:
Код:
if( GetPlayerState(playerid) == PLAYER_STATE_DRIVER && vehDB[GetPLayerVehicleID(playerid)][engine] == 1)
In that case, it would not execute when not needed?
Re: Question about vehicle speedometer. -
-Rebel Son- - 20.12.2011
Use a timer, OnPlayerUpdate calls to many times, Also remember GetPlayerVelocity!
Re: Question about vehicle speedometer. -
park4bmx - 20.12.2011
i got mine under
OnPlayerUpdate becouse if there were 500 players and i run a 1 seconds TimerEx for all of these players there would be increase in CPU and lag.
as under OnPlayerUpdate will not cause the same problem becouse is allredy being called !
Re: Question about vehicle speedometer. -
kizla - 20.12.2011
i will use function with global timer... onplayerupdate is the fastes, but isnt so good for souch things, use OnPlayerUpdate only for AntiCheat or something similarly...
Re: Question about vehicle speedometer. -
Universal - 21.12.2011
Hmm... Okay, thank you for your answers! I'll try to figure something out.
Re: Question about vehicle speedometer. -
Tee - 21.12.2011
Also there are ton loads of Speedometers on the forum, just take a look at a
simple one, or tow.