Garry's Mod Wiki

PLAYER

Represents a player class.

The player class hooks have one special field:

  • Player Player - The player for which a hook is called.
These hooks are used in player_manager this can't be hooked

Events

PLAYER:ClassChanged()
Called when the player's class was changed from this class.
PLAYER:Death()
Called when the player dies
Called from GM:FinishMove. This hook will not work if the current gamemode overrides GM:FinishMove and does not call this hook. This hook is run after the drive. FinishMove has been called.
Called on player spawn to determine which hand model to use
PLAYER:Init()
Called when the class object is created
PLAYER:Loadout()
Called on spawn to give the player their default loadout
boolean PLAYER:Move( CMoveData mv )
Called from GM:Move. This hook will not work if the current gamemode overrides GM:Move and does not call this hook. This hook is run after the drive. Move has been called.
PLAYER:PostDrawViewModel( Entity viewmodel, Entity weapon )
Called after the viewmodel has been drawn
PLAYER:PreDrawViewModel( Entity viewmodel, Entity weapon )
Called before the viewmodel is drawn
PLAYER:SetModel()
Called when we need to set player model from the class. This will only be called if you have not overridden GM:PlayerSetModel or call this function from it or anywhere else using player_manager. RunClass
PLAYER:SetupDataTables()
Setup the network table accessors.
PLAYER:Spawn()
Called when the player spawns
Called from GM:CreateMove. This hook will not work if the current gamemode overrides GM:SetupMove and does not call this hook. This hook is run after the drive. StartMove has been called.
PLAYER:ViewModelChanged( Entity viewmodel, string old, string new )
Called when the player changes their weapon to another one causing their viewmodel model to change