GM/PlayerInitialSpawn

From Garry's Mod
Revision as of 01:50, 24 December 2014 by Flowx (Talk | contribs)
Jump to: navigation, search
 GM:PlayerInitialSpawn( )

Contents

Description

Called when the player spawns for the first time.

Please note that this hook is called before the player has fully loaded. For example, trying to use the Entity:GetModel function will return the default model ("player/default.mdl") (It calls when the player is still seeing the 'Sending Client Info' screen)

Arguments

Player player

The player who spawned.

Examples

Example

Prints the name of the player joining.

function GM:PlayerInitialSpawn(ply)
	print( ply:GetName().." joined the server.\n" )
end

-- That way you are overriding the default hook
-- you can use hook.Add to make more functions get called when this event occurs
local function spawn(ply)
	print( ply:GetName().." joined the game.\n")
end
hook.Add( "PlayerInitialSpawn", "some_unique_name", spawn )

Output:

<somebody> joined the game
Personal tools
Navigation