Garry's Mod Wiki

spawnmenu.AddCreationTab

  spawnmenu.AddCreationTab( string name, function function, string material = "icon16/exclamation.png", number order = 1000, string tooltip = nil )

Description

Inserts a new tab into the CreationMenus table, which will be used by the creation menu to generate its tabs (Spawnlists, Weapons, Entities, etc.)

Arguments

1 string name
What text will appear on the tab (I.E Spawnlists).
2 function function
The function called to generate the content of the tab.
3 string material = "icon16/exclamation.png"
Path to the material that will be used as an icon on the tab.
4 number order = 1000
The order in which this tab should be shown relative to the other tabs on the creation menu.
5 string tooltip = nil
The tooltip to be shown for this tab.

Example

An excerpt from the Dupe creation menu tab.

spawnmenu.AddCreationTab( "#spawnmenu.category.dupes", function() HTML = vgui.Create( "DHTML" ); JS_Language( HTML ) HTML:SetAllowLua( true ); HTML:OpenURL( "asset://garrysmod/html/dupes.html" ); HTML:Call( "SetDupeSaveState( " .. tostring( DupeInClipboard ).. " );" ); return HTML end, "icon16/control_repeat_blue.png", 200 )
Output: A new tab named "Dupes" will be placed in the creation menu.