GetPlayerName

From SA-MP Wiki

Jump to: navigation, search

GetPlayerName


This function returns the player name.


Parameters:
(playerid, const name[], len)
playeridThe PlayerID you want to get the name from.
const name[]The string to store the name in, passed by reference.
lenNumber of cells the string has been assigned.


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

Personal tools
In other languages