• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Get coordinates where the player is looking!
#2
You can use something like this

new Float:angle, Float:x, Float:y, Float:z;

GetPlayerFacingAngle(playerid, angle);

GetPlayerPos(playerid, x, y, z);



And from there calculate the coordinates, if he is looking north, you know that in north the Y coordinate increases, if he is looking west, the X coordinate decreases.



Something like

new Float:lookingx, Float:lookingy;

if(angle == 0) // He is looking north

{

lookingx = x; // The already X position of the user

lookingy = y; // The position on Y of the user plus 10 meters.

}

if(angle == 90) // He is looking east

{

lookingx = x; // The already X position of the user plus 10 meters

lookingy = y; // The position on Y of the user.

}



And you'll calculate the angles with some mathematic formula.
Argentinian SA-MP Programmer. Playing since 2013.

  Reply


Messages In This Thread
RE: Get coordinates where the player is looking! - by Chessy - 2021-06-04, 04:16 PM

Forum Jump: