Garry's Mod Wiki

spawnmenu.AddToolCategory

  spawnmenu.AddToolCategory( string tabName, string className, string printName )

Description

Used to create a new category in the list inside of a spawnmenu Tool Tab.

You must call this function from SANDBOX:AddToolMenuCategories for it to work properly.

See spawnmenu.AddToolTab to add new tool tabs.
See spawnmenu.AddToolMenuOption to add new sub options to a newly created tool category.

Arguments

1 string tabName
The internal tool tab name, as created with spawnmenu.AddToolTab.

You can also use the default Tool Tab names "Main" and "Utilities".

2 string className
The unique identifier name, which will be used to add tool option to this category.
3 string printName
The nice name to be displayed to the player. See Addon Localization.

Example

Adds the Constraints category to the Main ToolTab. See lua\includes\modules\spawnmenu.lua.

hook.Add( "AddToolMenuTabs", "myHookName", function() spawnmenu.AddToolCategory( "Main", "Constraints", "#spawnmenu.tools.constraints" ) end )

Example

Adds the User category to the Utilities ToolTab. See lua\autorun\utilities_menu.lua.

hook.Add( "AddToolMenuTabs", "myHookName2", function() spawnmenu.AddToolCategory( "Utilities", "User", "#spawnmenu.utilities.user" ) end )