GetPlayerCameraPos
From SA-MP Wiki
(Difference between revisions)
Revision as of 13:21, 29 January 2014 Smithy (Talk | contribs) ← Previous diff |
Revision as of 01:22, 3 February 2014 Connor Mead (Talk | contribs) Next diff → |
||
Line 36: | Line 36: | ||
[[Category:Scripting Functions]] | [[Category:Scripting Functions]] | ||
+ | |||
+ | [[fr:GetPlayerCamera]] |
Revision as of 01:22, 3 February 2014
Description:
Get the position of the player's camera.
(playerid, Float:x, Float:y, Float:z)
playerid | The ID of the player to get the camera position of. |
Float:x | A float variable to store the X coordinate in, passed by reference. |
Float:y | A float variable to store the Y coordinate in, passed by reference. |
Float:z | A float variable to store the Z coordinate in, passed by reference. |
Return Values:
This function does not return any specific values.
Important | Players' camera positions are only updated once a second, unless aiming. It is recommended to set a 1 second timer if you wish to take action that relies on a player's camera position. |
public OnPlayerDisconnect(playerid) { new Float:x, Float:y, Float:z; GetPlayerCameraPos(playerid, x, y, z); printf("The player left when they had their camera at %f,%f,%f.", x, y, z); // You could write this to a userfile. return 1; }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- SetPlayerCameraPos: Set a player's camera position.
- GetPlayerCameraZoom: Get the zoom level of a player's camera.
- GetPlayerCameraAspectRatio: Get the aspect ratio of a player's camera.
- GetPlayerCameraMode: Get a player's camera mode.
- GetPlayerCameraFrontVector: Get the player's camera front vector