Quote:
Originally Posted by FUNExtreme
The only thing you certainly didn't do is use your brain.
If the top speeds aren't accurate, then neither is any other speed. seriously.
|
The max speeds aren't accurate because Rockstar didn't set them to be. I need a speed function based on an OBJECT's (a vehicle) velocity (METERS (units) PER SECOND). The calculation would be
EXACTLY the same for working out the MPH of an object being moved with MoveObject(). It has NOTHING to do with max speeds or vehicles.
The only way in which you could be right is if the GetVehicleVelocity function is inaccurate, but from what I know it is not. Even so, the old GetDistanceBetweenPoints method could be used (with the equation 'Speed = Distance/Time').
Quote:
Originally Posted by DaRk_RaiN
Here's this one, works like a charm.
pawn Код:
stock GetPlayerSpeed(playerid) { new Float:ST[4]; if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]); else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]); ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625; return floatround(ST[3]); }
|
Quote:
Originally Posted by MP2
I need an ACCURATE and CORRECT GetVehicleSpeed function that can return both MILES PER HOUR and KILOMETRES PER HOUR speeds. Obviously it needs to use GetVehicleVelocity.
I have searched for hours and only found bad ones that aren't accurate.
Thank you.
|
What is the '179.28625' for?