Vehicle In front of Vehicle - 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 In front of Vehicle (
/showthread.php?tid=411770)
Vehicle In front of Vehicle -
Glad2BeHere - 30.01.2013
How to determine if there is two vehicles near a player facing front
> = vehicle a
| = player
< = vehicle b
or atleast two vehicles facing each other
AW: Vehicle In front of Vehicle -
Kwashiorkor - 30.01.2013
You could compare GetPlayerFacingAngle to the angle between player and vehicle using atan2()
Re: Vehicle In front of Vehicle -
Threshold - 30.01.2013
I'm guessing this.would work:
pawn Код:
stock IsVehicleFacingVehicle(vehicleone, vehicletwo)
{
new Float:angle1, Float:angle2;
GetVehicleZAngle(vehicleone, angle1);
GetVehicleZAngle(vehicletwo, angle2);
if(angle1 > angle2)
{
if((angle1 - angle2) > 175 && (angle1 - angle2) < 185) return 1;
}
else
{
if((angle2 - angle1) > 175 && (angle2 - angle1) < 185) return 1;
}
return 0;
}
I'm sorry I you get any errors, I'm trying to script this on my phone. This took me like 20 minutes. xD
Edit: Also you could add a distance.check between the vehicles if.necessary.