28.04.2017, 15:18
There's nothing wrong with using OnPlayerUpdate if you know how to use it. This callback's main purpose is to provide a system to create your own custom callbacks like OnPlayerHealthChange, OnPlayerWeaponChange and things like that. Don't use it for things that the server controls (score and such) and don't use it as a general purpose timer.
I would probably move the "health" thingy to a separate function and call it from OnPlayerStateChange, OnVehicleDamageStatusUpdate and OnPlayerWeaponShot because most vehicle health changes occur due to collisions or bullets.
For a smooth experience you need at least 24 updates per second or the equivalent of a 40-ish milliseconds timer so speed and altitude can probably stay in OPU. They're only 5 lines of code which shouldn't cause any serious issues. Just make sure that your "get speed" function is optimized, i.e. use the VectorSize version, not the outdated and slow floatsqroot version.
I would probably move the "health" thingy to a separate function and call it from OnPlayerStateChange, OnVehicleDamageStatusUpdate and OnPlayerWeaponShot because most vehicle health changes occur due to collisions or bullets.
For a smooth experience you need at least 24 updates per second or the equivalent of a 40-ish milliseconds timer so speed and altitude can probably stay in OPU. They're only 5 lines of code which shouldn't cause any serious issues. Just make sure that your "get speed" function is optimized, i.e. use the VectorSize version, not the outdated and slow floatsqroot version.