getPlayerName
Client-side
Server-side
Shared
Pair: setPlayerName
This function returns a string containing the name of the specified player.
OOP Syntax Help! I don't understand this!
- Method: player:getName(...)
- Variable: .name
Syntax
string|false getPlayerName ( player thePlayer )
Required Arguments
- thePlayer: The player you want to get the name of.
Returns
- string|false: name
Returns a string containing the requested player's name, or false if the player passed to the function is invalid.
Code Examples
This example outputs the local player name to the chatbox.
addCommandHandler("myname", function() -- output local player's name to the chatbox outputChatBox(getPlayerName(localPlayer))end)
This example outputs the name of the player who executed the command to their chatbox.
addCommandHandler("myname", function(ply) outputChatBox("Your name: "..getPlayerName(ply), ply)end)
See Also
Player Functions
- getPlayerName