Vehicle's speed quick question - 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's speed quick question (
/showthread.php?tid=570198)
Vehicle's speed quick question -
Fel486 - 06.04.2015
I'm doubt if that's correct. That's about getVehicleSpeed in KM/H
pawn Код:
new Float:x, Float:y, Float:z;
if(IsPlayerInAnyVehicle(playerid))
{
GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
return (floatsqroot(x * x + y * y + z * z) * 180.00);
}
Otherwise, if anyone knows any other way...
AW: Vehicle's speed quick question -
Nero_3D - 06.04.2015
There is no right or wrong, just take some value, if you are bored read that topic
http://forum.sa-mp.com/showthread.ph...ighlight=speed
Try to use the native VectorSize (since 0.3z) for pythagoras
pawn Код:
stock Float: GetVehicleSpeed(vehicleid) {
new
Float: vX,
Float: vY,
Float: vZ
;
if(GetVehicleVelocity(vehicleid, vX, vY, vZ)) {
return VectorSize(vX, vY, vZ) * 180.0;
}
return 0.0;
}
Re: Vehicle's speed quick question -
Fel486 - 06.04.2015
Thanks!