Garry's Mod Wiki

Revision Difference

gameevent/player_changename#548562

<cat>gameevent</cat>⤶ <title>player_changename</title>⤶ ⤶ <structure>⤶ <realm>Shared</realm>⤶ <description>⤶ Called when a player changes their Steam name.⤶ </description>⤶ <fields>⤶ <item type="number" name="userid">The <page text="UserID">Player:UserID</page> of the Player.</item>⤶ <item type="string" name="oldname">The old Name.</item>⤶ <item type="string" name="newname">The new Name.</item>⤶ </fields>⤶ </structure>⤶ ⤶ # Examples⤶ <example>⤶ <description>This is a basic template with the purpose of including all arguments / table variables to make it easily known which values can be accessed.</description>⤶ <code>⤶ gameevent.Listen( "player_changename" )⤶ hook.Add( "player_changename", "player_changename_example", function( data ) ⤶ local id = data.userid // Same as Player:UserID() for the speaker⤶ local oldname = data.oldname // The old Name of the Player⤶ local newname = data.newname // The new Name of the Player⤶ ⤶ // Called when a player changes his Steam name.⤶ ⤶ end )⤶ </code>⤶ </example>