2021-06-04, 04:16 PM
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.
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.