GM/PlayerConnect

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Only called for host)
m
 
Line 26: Line 26:
 
PrintMessage( HUD_PRINTTALK, name .. " has joined the game." )
 
PrintMessage( HUD_PRINTTALK, name .. " has joined the game." )
 
end
 
end
|Output=if a person with the name "Garry :D" joins the game, a message in the chatbox will say "Garry :D has joined the game."
+
|Output=Player1 has joined the game.
 
}}
 
}}

Latest revision as of 19:40, 16 October 2019

 GM:PlayerConnect( )

Contents

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.

NOTE

This is only called clientside for listen server hosts.

NOTE

This is not called clientside for the local player.

Arguments

string name

The player's name.

Arguments

string ip

The player's IP address. Will be "none" for bots.

NOTE

This argument will only be passed serverside.

Examples

Example

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

function GM:PlayerConnect( name, ip )
	PrintMessage( HUD_PRINTTALK, name .. " has joined the game." )
end

Output:

Player1 has joined the game.
Personal tools
Navigation