Garry's Mod Wiki

Garry's Mod Wiki

  GM:PlayerConnect( string name, string ip )

Description

Executes when a player connects to the server. Called before the player has been assigned a UserID and entity. See the player_connect gameevent for a version of this hook called after the player entity has been created.

This is only called clientside for listen server hosts.
This is not called clientside for the local player.

Arguments

1 string name
The player's name.
2 string ip
The player's IP address. Will be "none" for bots.
This argument will only be passed serverside.

Example

prints a message to the chatbox when a player joins the game

hook.Add( "PlayerConnect", "JoinGlobalMessage", function( name, ip ) PrintMessage( HUD_PRINTTALK, name .. " has joined the game." ) end )
Output: Player1 has joined the game.

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...