GetPlayerName
From SA-MP
[edit]
GetPlayerName
This function returns the player name.
(playerid, const name[], len)
| playerid | The PlayerID you want to get the name from. |
| const name[] | The variable to save the name to. |
| len | Number of cells the variable has been assigned. |
This function returns the player' 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; }
[edit]
Related Functions
The following functions might be useful as well, as they're related to this function in one way or another.
- SetPlayerHealth: Change the player's health.
- SetTeamCount: Change the amount of teams that your gamemode counts.
- AddPlayerClassEx: Version of AddPlayerClass which also supports the default team.
- GetPlayerID: Returns the ID of a player.
