GetPlayerPos

From SA-MP

Jump to: navigation, search


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)
playeridThe PlayerID you want to locate.
&Float:xA variable to save the X coordinate too.
&Float:yA variable to save the Y coordinate too.
&Float:zA 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;
}

Related Functions

The following functions might be useful as well, as they're related to this function in one way or another.

  • SetTeamCount: Change the amount of teams that your gamemode counts.
Personal tools