Garry's Mod Wiki

Revision Difference

player_manager.RegisterClass#512532

<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( "&amp;lt;classname&amp;gt;" )</description>⤶ <code>PrintTable(baseclass.Get( "player_default" ))</code>⤶ <output>⤶ &amp;lt;br&amp;gt;Walkspeed = 300&amp;lt;br&amp;gt;⤶ RunSpeed = 500&amp;lt;br&amp;gt;⤶ CalcView = function: 0x00665988&amp;lt;br&amp;gt;⤶ UseVMHands = true&amp;lt;br&amp;gt;⤶ etc...⤶ </output>⤶ ⤶ </example>