Garry's Mod Wiki

Garry's Mod Wiki

  GM:PlayerInitialSpawn( Player player, boolean transition )

Description

Called when the player spawns for the first time.

See GM:PlayerSpawn for a hook called every player spawn.

This hook is called before the player has fully loaded, when the player is still in seeing the Starting Lua screen. For example, trying to use the Entity:GetModel function will return the default model (models/player.mdl).

Arguments

1 Player player
The player who spawned.
2 boolean transition
If true, the player just spawned from a map transition. (Specifically via trigger_changelevel or point_changelevel entities)

Example

Prints the name of the player joining.

function GM:PlayerInitialSpawn(ply) print( ply:Nick() .. " joined the server." ) end -- That way you are overriding the default hook. -- You can use hook.Add to make more functions get called when this event occurs. hook.Add( "PlayerInitialSpawn", "some_unique_name", function( ply ) print( ply:Nick() .." joined the game." ) end)
Output:
Player1 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 four times a day. Edits and history are not available.

Last Parsed: Loading...