How to check if the vehicle is moving back - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to check if the vehicle is moving back (
/showthread.php?tid=220870)
How to check if the vehicle is moving back -
Jefff - 04.02.2011
Like title says but without key_down
Re: How to check if the vehicle is moving back -
Finn - 04.02.2011
Check where the vehicle is going at (velocity) and compare it with the vehicle's facing angle.
Re: How to check if the vehicle is moving back -
Jefff - 04.02.2011
I dont understand velocity, can you give me example?
Re: How to check if the vehicle is moving back -
Mokerr - 04.02.2011
pawn Код:
stock IsVehicleDrivingBackwards(vehicleid)
{
new Float:Float[3];
if(GetVehicleVelocity(vehicleid, Float[1], Float[2], Float[0]))
{
GetVehicleZAngle(vehicleid, Float[0]);
if(Float[0] < 90)
{
if(Float[1] > 0 && Float[2] < 0) return true;
}
else if(Float[0] < 180)
{
if(Float[1] > 0 && Float[2] > 0) return true;
}
else if(Float[0] < 270)
{
if(Float[1] < 0 && Float[2] > 0) return true;
}
else if(Float[1] < 0 && Float[2] < 0) return true;
}
return false;
}
Credits to Joker
Re: How to check if the vehicle is moving back -
Jefff - 04.02.2011
Mokerr oh nice, thank you, I did not know that such a function exists