Player Behind Vehicle :O

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?

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

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)

Thx will try that one

Forum Jump:

Users browsing this thread: 1 Guest(s)