SA-MP Forums Archive
how can i tell if a player is infront of a vehicles front/Bonnet? - 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 can i tell if a player is infront of a vehicles front/Bonnet? (/showthread.php?tid=199513)



how can i tell if a player is infront of a vehicles front/Bonnet? - The_Gangstas - 15.12.2010

front/bonnet* not trunk sorry
does this seem possible? i tried somethign with getvehiclezangle then compared it with the players pos, but it didnt work


Re: how can i tell if a player is infront of a vehicles front/Bonnet? - Retardedwolf - 15.12.2010

pawn Код:
stock GetXYBehindOfVehicle(vehicleid, &Float:x, &Float:y, Float:distance)
{
    new
        Float:a;
    GetVehiclePos( vehicleid, x, y, a );
    GetVehicleZAngle( vehicleid, a );
    x += ( distance * floatsin( -a+180, degrees ));
    y += ( distance * floatcos( -a+180, degrees ));
}
Change that to make it go infront instead of behind.


Re: how can i tell if a player is infront of a vehicles front/Bonnet? - The_Gangstas - 15.12.2010

oh i forgot about getxy ok ty.

wait im stuck here
pawn Код:
new Float:px,Float:py,Float:pz,Float:x,Float:y;
GetPlayerPos(playerid,px,py,pz);
GetXYInFrontOfVehicle(GetPlayerVehicleID(playerid),x,y,2.4)
if(