Garry's Mod Wiki

Revision Difference

gameevent/player_spawn#548547

<cat>gameevent</cat>⤶ <title>player_spawn</title>⤶ ⤶ <structure>⤶ <realm>Shared</realm>⤶ <description>⤶ Called when a player spawns.⤶ ⤶ <note>⤶ This is not called clientside for the local player or in single-player.⤶ </note>⤶ </description>⤶ <fields>⤶ <item type="number" name="userid">The <page text="UserID">Player:UserID</page> the player has.</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_spawn" )⤶ hook.Add( "player_spawn", "player_spawn_example", function( data ) ⤶ local id = data.userid // Same as Player:UserID()⤶ ⤶ // Called when the player spawns initially or respawns.⤶ ⤶ end )⤶ </code>⤶ </example>