SA-MP Forums Archive
MPH and KMH - 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: MPH and KMH (/showthread.php?tid=308088)



MPH and KMH - Face9000 - 02.01.2012

So,i'm creating and anticheat and i've this stock:

pawn Код:
stock GetVehicleSpeed(vehicleid)
{
    new Float:v_vX, Float:v_vY, Float:v_vZ, Float:retres;
    GetVehicleVelocity(vehicleid, v_vX, v_vY, v_vZ);
    retres = floatsqroot(floatabs(floatpower(v_vX + v_vY + v_vZ, 2)));
    return floatround(retres * 100, floatround_ceil);
}
This detects MPH speed,i need to detect KMH speed,how?Thanks.


Re: MPH and KMH - HondaCBR - 02.01.2012

You could multiply the value that you get by *1.6 - this would convert it to KMH.


Re: MPH and KMH - Dark_Kostas - 02.01.2012

return (floatround(retres * 100, floatround_ceil)*1.6);


Re: MPH and KMH - Face9000 - 02.01.2012

Thanks to both