SA-MP Forums Archive
Vehicle speed - 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: Vehicle speed (/showthread.php?tid=503581)



Vehicle speed - Lajko1 - 30.03.2014

Hey I got a stock for vehicle speed but at Turismo it shows only 177kmh when car like that should reach around 230 kmh?

Here is the stock to get Speed but I don't like when turismo reaches only 177 kmh
how to raise that speed?

pawn Код:
stock GetVehicleSpeed(playerid, bool:kmh = true)
{
    new
        Float:xx,
        Float:yy,
        Float:zz,
        Float:pSpeed;

    if(IsPlayerInAnyVehicle(playerid))
    {
        GetVehicleVelocity(GetPlayerVehicleID(playerid),xx,yy,zz);
    }
    else
    {
        GetPlayerVelocity(playerid,xx,yy,zz);
    }

    pSpeed = floatsqroot((xx * xx) + (yy * yy) + (zz * zz));
    return kmh ? floatround((pSpeed * 165.12)) : floatround((pSpeed * 136.666667));
}



Re: Vehicle speed - Conradus - 30.03.2014

To raise the speed it returns, you can just make the numbers in the calculation bigger.
So instead of using 165.12 and 136.666667, you could use something like 220 and 136.7.