GetPlayerPos

From SA-MP Wiki

Jump to: navigation, search

GetPlayerPos


Find out where a player is.


Parameters:
(playerid, Float:x, Float:y, Float:z)
playeridThe PlayerID you want to locate.
Float:xA float to store the X coordinate, passed by reference.
Float:yA float to store the Y coordinate, passed by reference.
Float:zA float to store the Z coordinate, passed by reference.


ReturnsThis 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.

Personal tools