15.01.2012, 16:35
Okay, watch the speed in the video (aka. look at the TDs).
[ame]http://www.youtube.com/watch?v=mpUcxMGwQ8M[/ame]
Notice how the speed is jumping? What could be causing that? Here's the code:
[ame]http://www.youtube.com/watch?v=mpUcxMGwQ8M[/ame]
Notice how the speed is jumping? What could be causing that? Here's the code:
pawn Код:
timer vehicleDashboard[500](playerid, vehicleid)
{
// some other functions here
new szString[23];
format(szString, sizeof(szString), "%d MP/H %d KM/H", GetVehicleSpeed(vehicleid, true), GetVehicleSpeed(vehicleid, false));
TextDrawSetString(vehicleSpeedTD[playerid], szString);
}
stock GetVehicleSpeed(vehicleid, bool:MPH = true)
{
new Float:x, Float:y, Float:z, vel;
GetVehicleVelocity( vehicleid, x, y, z );
if(MPH == true) vel = floatround( floatsqroot( x*x + y*y + z*z ) * 180 / 1.609344 ); // MPH
else vel = floatround( floatsqroot( x*x + y*y + z*z ) * 180 ); // KPH
return vel;
}