GetPlayerPos
From SA-MP
[edit]
GetPlayerPos
You can use this function to the location of a specific player, it returns the X, Y and Z coordinate of the players position.
(playerid, &Float:x, &Float:y, &Float:z)
| playerid | The PlayerID you want to locate. |
| &Float:x | A variable to save the X coordinate too. |
| &Float:y | A variable to save the Y coordinate too. |
| &Float:z | A variable to save the Z coordinate too. |
This function returns coordinates of the current position of the player.
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; }
[edit]
Related Functions
The following functions might be useful as well, as they're related to this function in one way or another.
- SetPlayerPos: Spawn the player at a specific location.
- SetTeamCount: Change the amount of teams that your gamemode counts.
- AddPlayerClassEx: Version of AddPlayerClass which also supports the default team.
