Garry's Mod Wiki

Revision Difference

spawnmenu.AddCreationTab#512867

<function name="AddCreationTab" parent="spawnmenu" type="libraryfunc">⤶ <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.)</description>⤶ <realm>Client</realm>⤶ <args>⤶ <arg name="name" type="string">What text will appear on the tab (I.E Spawnlists).</arg>⤶ <arg name="function" type="function">The function called to generate the content of the tab.</arg>⤶ <arg name="material" type="string" default="icon16/exclamation.png">Path to the material that will be used as an icon on the tab.</arg>⤶ <arg name="order" type="number" default="1000">The order in which this tab should be shown relative to the other tabs on the creation menu.</arg>⤶ <arg name="tooltip" type="string" default="nil">The tooltip to be shown for this tab.</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>An excerpt from the Dupe creation menu tab.</description>⤶ <code>⤶ 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 )⤶ </code>⤶ <output>A new tab named "Dupes" will be placed in the creation menu.</output>⤶ ⤶ </example>