SA-MP Forums Archive
Player Behind Vehicle :O - 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: Player Behind Vehicle :O (/showthread.php?tid=126893)



Player Behind Vehicle :O - aNdReSkKkK - 10.02.2010

Hey, anybody has a clue how would u identify if a player, on foot, is vehind a vehicle?

I have a trunk fuction but right now it works when player is in vehicle :P would like to do it if it's behind it

any tips?


Re: Player Behind Vehicle :O - BP13 - 10.02.2010

you could use IsPlayerToPoint and check if their state is on foot.


Re: Player Behind Vehicle :O - Joe Staff - 10.02.2010

You can try this
pawn Код:
stock IsPlayerInFrontVehicle(playerid,vehicleid,Float:radius,Float:vehiclelength)
{
  new Float:x,Float:y,Float:z,Float:a;
  GetVehiclePos(vehicleid, x, y, z);
  GetPlayerFacingAngle(vehicleid, a);
  x += (vehiclelength* floatsin(-a, degrees));
  y += (vehiclelength* floatcos(-a, degrees));
  return IsPlayerInRangeOfPoint(playerid,radius,x,y,z);
}
'vehiclelength' would be the distance between the middle of the car to the front/back of it. (In your case you would set this to a negative number, i.e. -4.0)
'radius' would be the area of the spot inwhich the player must be. (i.e. 3.0)


Re: Player Behind Vehicle :O - aNdReSkKkK - 10.02.2010

Thx will try that one