GetVehicleVelocity help - 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: GetVehicleVelocity help (
/showthread.php?tid=290002)
GetVehicleVelocity help -
Metallica502 - 13.10.2011
well you know how you use
if isplayertopoint or in range of point
well i kinda of need to know how to use the if function with GetVehicleVelocity im making a back up beeper for trucks and i want it to only go off only if the player is going backwards
please help,
metallica
Re: GetVehicleVelocity help -
Stigg - 13.10.2011
You could use:
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;
}
To see if the vehicle is going backwards.
Re: GetVehicleVelocity help -
Metallica502 - 13.10.2011
OMG thanks dude your a life saver
Re: GetVehicleVelocity help -
Stigg - 13.10.2011
Quote:
Originally Posted by Metallica502
OMG thanks dude your a life saver
|
No prob's, glad i could help.
Re: GetVehicleVelocity help -
Metallica502 - 13.10.2011
btw i want ur internet provider xD
Re: GetVehicleVelocity help -
Metallica502 - 13.10.2011
and will you please take a look at the pm i sent you id appreciate it grately