player manager/OnPlayerSpawn

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m (edit with form to make page source nicer)
(Remove the source, this is what the Source button is for)
Line 10: Line 10:
|desc=Player to setup
|desc=Player to setup
|Description=Source for player_manager.OnPlayerSpawn (from lua/includes/modules/player_manager.lua)
|Code=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 )

Revision as of 16:24, 30 September 2019

 player_manager.OnPlayerSpawn( )


Applies basic class variables when the player spawns.

Called from GM:PlayerSpawn in the base gamemode.


Player ply

Player to setup
Personal tools