GetPlayerName

From SA-MP

Jump to: navigation, search


GetPlayerName

This function returns the player name.


(playerid, const name[], len)
playeridThe PlayerID you want to get the name from.
const name[]The variable to save the name to.
lenNumber 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;
}

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