Garry's Mod Wiki

spawnmenu.AddContentType

  spawnmenu.AddContentType( string name, function constructor )

Description

Registers a new content type that is saveable into spawnlists. Created/called by spawnmenu.CreateContentIcon.

Arguments

1 string name
An unique name of the content type.
2 function constructor
A function that is called whenever we need create a new panel for this content type.

Function callback arguments are:

Example

A simple header content type.

spawnmenu.AddContentType( "header", function( container, obj ) if ( !obj.text or type(obj.text) != "string" ) then return end local label = vgui.Create( "ContentHeader", container ) label:SetText( obj.text ) container:Add( label ) end )