Garry's Mod Wiki

player_manager

The player_manager library lets you manage players, such as setting their models or creating player classes.

Methods

player_manager.AddValidHands( string name, string model, number skin = 0, string bodygroups = "0000000", boolean matchBodySkin = false )
Assigns view model hands to player model.
player_manager.AddValidModel( string name, string model )
Associates a simplified name with a path to a valid player model. Only used internally.
table player_manager.AllValidModels()
Returns the entire list of valid player models.
player_manager.ClearPlayerClass( Player ply )
Clears a player's class association by setting their ClassID to 0
string player_manager.GetPlayerClass( Player ply )
Gets a players class
table player_manager.GetPlayerClasses()
Retrieves a copy of all registered player classes.
table player_manager.GetPlayerClassTable( Player ply )
Gets a players' class table
player_manager.OnPlayerSpawn( Player ply, boolean transiton )
Applies basic class variables when the player spawns. Called from GM:PlayerSpawn in the base gamemode.
player_manager.RegisterClass( string name, table table, string base = nil )
Register a class metatable to be assigned to players later
vararg player_manager.RunClass( Player ply, string funcName, vararg arguments )
Execute a named function within the player's set class
player_manager.SetPlayerClass( Player ply, string className )
Sets a player's class
table player_manager.TranslatePlayerHands( string name )
Retrieves correct hands for given player model. By default returns citizen hands. See player_manager. AddValidHands for defining/linking hands to a model - this must be defined somewhere otherwise the model will return citizen hands here.
string player_manager.TranslatePlayerModel( string shortName )
Returns the valid model path for a simplified name.
string player_manager.TranslateToPlayerModelName( string model )
Returns the simplified name for a valid model path of a player model. Opposite of player_manager. TranslatePlayerModel.