player_connect
Description
Called when a player connects to the server.
This is only called serverside AND clientside for the listen server host. In other cases it's called serverside.
Parameters
number bot
0 if the player isn't a bot, 1 if they are.
number index
The entity index of the player, minus one.
Examples
Example
Announce to everyone that a player has connected.
gameevent.Listen( "player_connect" )
hook.Add("player_connect", "AnnounceConnection", function( data )
for i, ply in ipairs( player.GetAll() ) do
ply:ChatPrint( data.name .. " has connected to the server." )
end
end)
Output:
Player1 has connected to the server.