GetPlayerFacingAngle

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 14:11, 18 March 2017
OstGot (Talk | contribs)

← Previous diff
Current revision
OstGot (Talk | contribs)

Line 3: Line 3:
{{Description|Gets the angle a player is facing.}} {{Description|Gets the angle a player is facing.}}
-{{Parameters|playerid,Float:Angle}}+{{Parameters|playerid, Float:Angle}}
{{Param|playerid|The player you want to get the angle of.}} {{Param|playerid|The player you want to get the angle of.}}
{{Param|Float:Angle|The Float to store the angle in, passed by reference.}} {{Param|Float:Angle|The Float to store the angle in, passed by reference.}}

Current revision



Description:

Gets the angle a player is facing.


Parameters:
(playerid, Float:Angle)
playeridThe player you want to get the angle of.
Float:AngleThe Float to store the angle in, passed by reference.


Return Values:

This function does not return any specific values.
  • The player's angle is stored in the specified variable.


Image:32px-Circle-style-warning.png

Important
Note

Angles are reversed in GTA:SA; 90 degrees would be East in the real world, but in GTA:SA 90 degrees is in fact West. North and South are still 0/360 and 180. To convert this, simply do 360 - angle.


Image:32px-Ambox_warning_orange.png

Note

Angles returned when inside a vehicle is rarely correct. To get the correct facing angle while inside a vehicle, use GetVehicleZAngle.


Example Usage:

new Float:Angle, string[26];
GetPlayerFacingAngle(playerid, Angle);
format(string, sizeof(string), "Your facing angle: %0.2f", Angle);
SendClientMessage(playerid, 0xFFFFFFFF, string);

Related Functions

The following functions may be useful, as they are related to this function in one way or another.

Personal tools
In other languages