Garry's Mod Wiki

Revision Difference

player_manager.RegisterClass#524884

<function name="RegisterClass" parent="player_manager" type="libraryfunc"> <description>Register a class metatable to be assigned to players later</description> <realm>Shared</realm> <args> <arg name="name" type="string">Class name</arg> <arg name="table" type="table">Class metatable</arg> <arg name="base" type="string">Base class name</arg> </args> </function> <example> <description>A quick look at registering a class table</description> <code> local PLAYER = {} PLAYER.DisplayName = "Default Class" ⤶ ... ⤶ -- ... player_manager.RegisterClass( "player_default", PLAYER, nil ) </code> </example> <example> <description>You can retrieve the data you've set when registering the table using baseclass.Get( "&lt;classname&gt;" )</description> <code>PrintTable(baseclass.Get( "player_default" ))</code> <code>PrintTable( baseclass.Get( "player_default" ) )</code> <output> &lt;br&gt;Walkspeed = 300&lt;br&gt;⤶ RunSpeed = 500&lt;br&gt;⤶ CalcView = function: 0x00665988&lt;br&gt;⤶ UseVMHands = true&lt;br&gt;⤶ etc...⤶ ```⤶ Walkspeed = 300⤶ RunSpeed = 500⤶ CalcView = function: 0x00665988⤶ UseVMHands = true⤶ --- etc...⤶ ```⤶ </output> </example>