GetPlayerCameraPos

From SA-MP Wiki

Jump to: navigation, search


GetPlayerCameraPos was added in SA-MP 0.3a This function was added in SA-MP 0.3a and will not work in earlier versions!


Description:

Get the position of the player's camera.


Parameters:
(playerid, Float:x, Float:y, Float:z)
playeridThe ID of the player to get the camera position of.
Float:xA float variable to store the X coordinate in, passed by reference.
Float:yA float variable to store the Y coordinate in, passed by reference.
Float:zA float variable to store the Z coordinate in, passed by reference.


Return Values:

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


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

Important
Note

Player's 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.

Personal tools
Navigation
Toolbox
In other languages