Garry's Mod Wiki

Revision Difference

Player:GetName#528168

<function name="GetName" parent="Player" type="classfunc"> <description> Returns the player's name, this is an alias of <page>Player:Nick</page>. <note>This function overrides <page>Entity:GetName</page> (in the Lua metatable, not in c++), keep it in mind when dealing with <page>ents.FindByName</page> or any engine function which requires the mapping name.</note> </description> <realm>Shared</realm> <rets> <ret name="" type="string">The player's name.⤶ <bug issue="3178">This is limited to 31 characters even though Steam names can have 32.</bug></ret>⤶ <ret name="" type="string">The player's name.</ret>⤶ </rets> </function> <example> <description>Prints the player's name</description> <code>print( Entity( 1 ):GetName() )</code> <output>Player1</output> </example>