Garry's Mod Wiki

spawnmenu

The spawnmenu library is a set of functions that allow you to control the spawn (Q) menu.

Methods

spawnmenu.ActivateTool( string tool )
Activates a tool, opens context menu and brings up the tool gun.
spawnmenu.ActivateToolPanel( number tab, Panel cp )
Activates tools context menu in specified tool tab.
Panel spawnmenu.ActiveControlPanel()
Returns currently opened control panel of a tool, post process effect or some other menu in spawnmenu.
spawnmenu.AddContentType( string name, function constructor )
Registers a new content type that is saveable into spawnlists. Created/called by spawnmenu.CreateContentIcon.
spawnmenu.AddCreationTab( string name, function function, string material = "icon16/exclamation.png", number order = 1000, string tooltip = "nil" )
Inserts a new tab into the CreationMenus table, which will be used by the creation menu to generate its tabs (Spawnlists, Weapons, Entities, etc.)
spawnmenu.AddPropCategory( string classname, string name, table contents, string icon, number id = 1000, number parentID = 0, string needsApp )
Used to add addon spawnlists to the spawnmenu tree. This function should be called within SANDBOX:PopulatePropMenu. Addon spawnlists will not save to disk if edited. You should never try to modify player customized spawnlists!
spawnmenu.AddToolCategory( string tab, string RealName, string PrintName )
Used to create a new category in the list inside of a spawnmenu ToolTab. You must call this function from SANDBOX:AddToolMenuCategories for it to work properly.
spawnmenu.AddToolMenuOption( string tab, string category, string class, string name, string cmd, string config, function cpanel, table table = {} )
Adds an option to the right side of the spawnmenu
spawnmenu.AddToolTab( string name, string label = "name", string icon = "icon16/wrench.png" )
Adds a new tool tab to the right side of the spawnmenu via the SANDBOX:AddToolMenuTabs hook. This function is a inferior duplicate of spawnmenu.GetToolMenu, just without its return value.
spawnmenu.ClearToolMenus()
Clears all the tools from the different tool categories and the categories itself, if ran at the correct place. Seems to only work when ran at initialization.
Panel spawnmenu.CreateContentIcon( string type, Panel parent, table data )
Creates a new content icon.
spawnmenu.DoSaveToTextFiles( table spawnlists )
This is used internally - although you're able to use it you probably shouldn't. Calls spawnmenu.SaveToTextFiles.
function spawnmenu.GetContentType( string contentType )
Returns the function to create an vgui element for a specified content type
table spawnmenu.GetCreationTabs()
Gets the CreationMenus table, which was filled with creation menu tabs from spawnmenu.AddCreationTab.
table spawnmenu.GetCustomPropTable()
Similar to spawnmenu.GetPropTable, but only returns spawnlists created by addons via spawnmenu.AddPropCategory. These spawnlists are shown in a separate menu in-game.
table spawnmenu.GetPropTable()
Returns a table of all prop categories and their props in the spawnmenu. Note that if the spawnmenu has not been populated, this will return an empty table. This will not return spawnlists created by addons, see spawnmenu.GetCustomPropTable for that.
table spawnmenu.GetToolMenu( string name, string label = "name", string icon = "icon16/wrench.png" )
Adds a new tool tab (or returns an existing one by name) to the right side of the spawnmenu via the SANDBOX:AddToolMenuTabs hook.
table spawnmenu.GetTools()
Gets a table of tools on the client.
spawnmenu.PopulateFromEngineTextFiles()
This is used internally - although you're able to use it you probably shouldn't. Calls spawnmenu.PopulateFromTextFiles.
spawnmenu.PopulateFromTextFiles( function callback )
Loads spawnlists from text files.
spawnmenu.SaveToTextFiles( table spawnlists )
This is used internally - although you're able to use it you probably shouldn't. Saves a table of spawnlists to files.
spawnmenu.SetActiveControlPanel( Panel pnl )
Sets currently active control panel to be returned by spawnmenu.ActiveControlPanel.
spawnmenu.SwitchToolTab( number id )
We advise against using this. It may be changed or removed in a future update. Supposed to open specified tool tab in spawnmenu, in reality does nothing.

Page Links


Special Pages


Wikis

?

Render Time: 28ms

DB GetPage 3
Generate Html 2
SaveChanges (1) 9
Render Body 0
Render Sidebar 11