GetPlayerName
From SA-MP Wiki
GetPlayerName
This function returns the player name.
(playerid, const name[], len)
| playerid | The PlayerID you want to get the name from. |
| const name[] | The string to store the name in, passed by reference. |
| len | Number of cells the string has been assigned. |
| Returns | This function returns the length of player's name. |
public OnPlayerConnect(playerid) { //Get the name of the new player and inform the other players //about a new player new name[MAX_PLAYER_NAME], string[48]; GetPlayerName(playerid, name, sizeof(name)); format(string, sizeof(string), "%s has joined the server.", name ); SendClientMessageToAll(0xFFFF00AA, string); return 1; }
Related Functions
The following functions might be useful as well, as they're related to this function in one way or another.
- SetPlayerName: Set a player's name.
