GetPlayerPos
From SA-MP Wiki
GetPlayerPos
Find out where a player is.
(playerid, Float:x, Float:y, Float:z)
| playerid | The PlayerID you want to locate. |
| Float:x | A float to store the X coordinate, passed by reference. |
| Float:y | A float to store the Y coordinate, passed by reference. |
| Float:z | A float to store the Z coordinate, passed by reference. |
| Returns | This function returns coordinates of the current position of the player. |
Example:
public OnPlayerDisconnect(playerid) { //Save the players location so we can spawn him there again on connect. new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); printf("The player left when he was at %f,%f,%f.", x, y, z); // Output: The player left when he was at 1234.34234,2345.366,15.3647. // You could write this to a userfile. return 1; }
Related Functions
The following functions might be useful as well, as they're related to this function in one way or another.
- SetPlayerPos: Set a player's position.
- GetVehiclePos: Get the position of a vehicle.
