SA-MP Forums Archive
Getspeed bug? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Getspeed bug? (/showthread.php?tid=296858)



Getspeed bug? - SourceCode - 13.11.2011

I saw many speedo meter scripts, they all dont work well, they show less speed even when i am going fast
the function being used is
Код:
stock GetPlayerSpeedSpeedo(playerid, bool:kmh) // by misco
{
    new Float:Vx,Float:Vy,Float:Vz,Float:rtn;
    if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz);
    rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2)));
    return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
}



Re: Getspeed bug? - Vince - 13.11.2011

pawn Код:
return kmh ? floatround((pSpeed * 195.12)) : floatround((pSpeed * 121.9));
That's what I'm using. Tweaked it myself using the values in the handling.dat (Infernus top speed 240 KM/h).