player_manager.OnPlayerSpawn

From Garry's Mod
Jump to: navigation, search
 player_manager.OnPlayerSpawn( )

Contents

Description

Applies basic class variables when the player spawns.

Called from GM:PlayerSpawn in the base gamemode.

Arguments

Player ply

Player to setup

Examples

Example

Source for player_manager.OnPlayerSpawn (from lua/includes/modules/player_manager.lua)

function OnPlayerSpawn( ply )

 local class = LookupPlayerClass( ply )
 if ( !class ) then return end

 ply:SetWalkSpeed( class.WalkSpeed )
 ply:SetRunSpeed( class.RunSpeed )
 ply:SetCrouchedWalkSpeed( class.CrouchedWalkSpeed )
 ply:SetDuckSpeed( class.DuckSpeed )
 ply:SetUnDuckSpeed( class.UnDuckSpeed )
 ply:SetJumpPower( class.JumpPower )
 ply:AllowFlashlight( class.CanUseFlashlight )
 ply:SetMaxHealth( class.MaxHealth )
 ply:SetHealth( class.StartHealth )
 ply:SetArmor( class.StartArmor )
 ply:ShouldDropWeapon( class.DropWeaponOnDie )
 ply:SetNoCollideWithTeammates( class.TeammateNoCollide )
 ply:SetAvoidPlayers( class.AvoidPlayers )

end


Personal tools
Navigation