Garry's Mod Wiki

Revision Difference

spawnmenu.GetToolMenu#512854

<function name="GetToolMenu" parent="spawnmenu" type="libraryfunc">⤶ <description>Adds a new tool tab (or returns an existing one by name) to the right side of the spawnmenu via the <page>SANDBOX:AddToolMenuTabs</page> hook.</description>⤶ <realm>Client</realm>⤶ <args>⤶ <arg name="name" type="string">The internal name of the tab. This is used for sorting.</arg>⤶ <arg name="label" type="string" default="name">The &#x27;nice&#x27; name of the tab</arg>⤶ <arg name="icon" type="string" default="icon16/wrench.png">The filepath to the icon of the tab. Should be a .png</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="table">A table of tables representing categories and items in the left part of the tab. See example below to example structure.</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Prints out the contents of the default Tool Tab.</description>⤶ <code>PrintTable( spawnmenu.GetToolMenu( "Main" ) )</code>⤶ <outputfixedwidth>Fixed width</outputfixedwidth>⤶ <output>⤶ 1:⤶ 1:⤶ CPanelFunction = function: 0x48a60408⤶ Command = gmod_tool axis⤶ Controls = axis⤶ ItemName = axis⤶ Text = #tool.axis.name⤶ 2:⤶ CPanelFunction = function: 0x48a6b218⤶ Command = gmod_tool ballsocket⤶ Controls = ballsocket⤶ ItemName = ballsocket⤶ Text = #tool.ballsocket.name⤶ 3:⤶ CPanelFunction = function: 0x48a8be48⤶ Command = gmod_tool elastic⤶ Controls = elastic⤶ ItemName = elastic⤶ Text = #tool.elastic.name⤶ 4:⤶ CPanelFunction = function: 0x48ab5998⤶ Command = gmod_tool hydraulic⤶ Controls = hydraulic⤶ ItemName = hydraulic⤶ Text = #tool.hydraulic.name⤶ ...⤶ ItemName = Constraints⤶ Text = #spawnmenu.tools.constraints⤶ 2:⤶ 1:⤶ CPanelFunction = function: 0x3a4235c8⤶ Command = gmod_tool balloon⤶ Controls = balloon⤶ ItemName = balloon⤶ Text = #tool.balloon.name⤶ ...⤶ ItemName = Construction⤶ Text = #spawnmenu.tools.construction⤶ ...⤶ </output>⤶ ⤶ </example>