Weird speed readings...
#1

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:

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;
}
Reply


Messages In This Thread
Weird speed readings... - by Scenario - 15.01.2012, 16:35
Re: Weird speed readings... - by Kar - 15.01.2012, 16:52
Re: Weird speed readings... - by Babul - 15.01.2012, 17:17

Forum Jump:


Users browsing this thread: 1 Guest(s)