Description:
Get a player's name.
Parameters:
(playerid, name[], len)
playerid | The ID of the player to get the name of. |
name[] | An array into which to store the name, passed by reference. |
len | The length of the string that should be stored. Recommended to be MAX_PLAYER_NAME + 1. The + 1 is necessary to account for the null terminator. |
Return Values:
The length of the player's name. 0 if player specified doesn't exist.
- The player's name is stored in the specified array.
Exemplo usado:
- Código:
public OnPlayerConnect(playerid)
{
// Get the name of the player that connected and display a join message to other players
new name[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, name, sizeof(name));
new string[MAX_PLAYER_NAME + 23 + 1];
format(string, sizeof(string), "%s has joined the server.", name);
SendClientMessageToAll(0xC4C4C4FF, string);
return 1;
}
Fonte: Wiki sa-mp