Revision Difference
GM:PlayerConnect#511096
<function name="PlayerConnect" parent="GM" type="hook">⤶
<ishook>yes</ishook>⤶
<description>⤶
Executes when a player connects to the server. Called before the player has been assigned a [UserID](/gmod/Player/UserID) and entity. See the [player_connect gameevent](/gmod/Game_Events) for a version of this hook called after the player entity has been created.⤶
⤶
<note>This is only called clientside for listen server hosts.</note>⤶
<note>This is not called clientside for the local player.</note>⤶
</description>⤶
<realm>Shared</realm>⤶
<predicted>No</predicted>⤶
<args>⤶
<arg name="name" type="string">The player's name.</arg>⤶
<arg name="ip" type="string">The player's IP address. Will be "none" for bots.

<note>This argument will only be passed serverside.</note></arg>⤶
</args>⤶
</function>⤶
⤶
<example>⤶
<description>prints a message to the chatbox when a player joins the game</description>⤶
<code>⤶
function GM:PlayerConnect( name, ip )⤶
PrintMessage( HUD_PRINTTALK, name .. " has joined the game." )⤶
end⤶
</code>⤶
<output>Player1 has joined the game.</output>⤶
⤶
</example>