Revision Difference
gameevent/player_connect_client#548570
<cat>gameevent</cat>
<title>player_connect_client</title>
<structure>
<realm>Shared</realm>
<description>
Called when a player connects to the server.
<note>This is not called clientside for the local player or in single-player.</note>
</description>
<fields>
<item type="number" name="bot">0 if the player isn't a bot, 1 if they are.</item>
<item type="string" name="networkid">The SteamID the player has. Will be `BOT` for bots and `STEAM_0:0:0` in single-player.</item>
<item type="string" name="name">The <page text="name">Player:Nick</page> the player has.</item>
<item type="number" name="userid">The <page text="UserID">Player:UserID</page> the player has.</item>
<item type="number" name="index">The <page text="entity index">Entity:EntIndex</page> of the player, minus one.</item>
<item type="number" name="index">The <page text="EntIndex">Entity:EntIndex</page> of the player, minus one.</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_connect_client" )
hook.Add( "player_connect_client", "player_connect_client_example", function( data )
local name = data.name // Same as Player:Nick()
local steamid = data.networkid // Same as Player:SteamID()
local id = data.userid // Same as Player:UserID()
local bot = data.bot // Same as Player:IsBot()
local index = data.index // Same as Entity:EntIndex() minus one
// Player has connected; this happens instantly after they join -- do something..
end )
</code>
</example>