GM:PlayerSpawn

From Garry's Mod
Jump to: navigation, search
 GM:PlayerSpawn( )

Contents

Description

Called whenever a player spawns, including respawns.

WARNING By default, in "base" derived gamemodes, this hook will also calls GM:PlayerLoadout and GM:PlayerSetModel, which may override some of your calls from hooking to this hook using the hook library, such as Entity:SetModel.

See function definition for GM:PlayerSpawn in base gamemode.

Arguments

Player player

The player who spawned.

Examples

Example

Prints a message when a player spawns.

function GM:PlayerSpawn( ply )
    MsgN( ply:Nick() .. " has spawned!" )
end

Output:

Player1 has spawned!

Examples

Example

Prints a message when a player spawns using a hook.

local function spawn( ply )
	print( ply:Nick().. " has spawned!.")
end
hook.Add( "PlayerSpawn", "some_unique_name", spawn )

Output:

Player1 has spawned!
Personal tools
Navigation