Garry's Mod Wiki

Revision Difference

gameevent/player_activate#548561

<cat>gameevent</cat>⤶ <title>player_activate</title>⤶ ⤶ <structure>⤶ <realm>Shared</realm>⤶ <description>⤶ Called when a player has entered the game (connected and loaded). ⤶ From this point you can use <page>Global.Player</page>(userid) (serverside or in singleplayer)⤶ ⤶ <note>This is called after <page>GM:PlayerInitialSpawn</page> so you could just use that hook serverside.</note>⤶ </description>⤶ <fields>⤶ <item type="number" name="userid">The <page text="UserID">Player:UserID</page> of the Player.</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_activate" )⤶ hook.Add( "player_activate", "player_activate_example", function( data ) ⤶ local id = data.userid // Same as Player:UserID() for the speaker⤶ ⤶ // Called when a player is fully connected and loaded⤶ ⤶ end )⤶ </code>⤶ </example>