Ok so I was going though gmod lua wiki and I found spawnmenu.AddCreationTab does creationtab mean along the TOP. If not, how can I make a new TAB along the top?
And, I am trying to add it too the default Sandbox Q menu, along the top and then add my own items. Just like Entities tab.
[editline]31st August 2016[/editline]
*As a simple Script..
Why don't you try it to find out
[editline]31st August 2016[/editline]
The example should be enough of a hint... it literally has the dupe tab code
Im asking, because I am on my Phone right now..
[editline]31st August 2016[/editline]
[QUOTE=MPan1;50976971]Why don't you try it to find out
[editline]31st August 2016[/editline]
The example should be enough of a hint... it literally has the dupe tab code[/QUOTE]
So if I put that in a Scriptfile, it would make a new tab in the Sandbox Q menu?
[QUOTE=jacobcooper18;50976974]So if I put that in a Scriptfile, it would make a new tab in the Sandbox Q menu?[/QUOTE]
[IMG]http://i.imgur.com/uMZRsZ4.png[/IMG]
You could've just tested it instead of spending such a long time making a thread and typing all this stuff out on a tiny phone screen
[QUOTE=MPan1;50977013][IMG]http://i.imgur.com/uMZRsZ4.png[/IMG]
You could've just tested it instead of spending such a long time making a thread and typing all this stuff out on a tiny phone screen[/QUOTE]
[CODE]list.Add( "SpawnableCustom", "Car" )
hook.Add( "PopulateCustomTab", "AddCustomContent", function( pnlContent, tree, node )
local Categorised = {}
local SpawnableEntities = list.Get( "SpawnableCustom" )
if ( SpawnableEntities ) then
for k, v in pairs( SpawnableEntities ) do
v.SpawnName = k
v.Category = v.Category or "Other"
Categorised[ v.Category ] = Categorised[ v.Category ] or {}
table.insert( Categorised[ v.Category ], v )
end
end
--
-- Add a tree node for each category
--
for CategoryName, v in SortedPairs( Categorised ) do
-- Add a node to the tree
local node = tree:AddNode( CategoryName, "icon16/bricks.png" )
-- When we click on the node - populate it using this function
node.DoPopulate = function( self )
-- If we've already populated it - forget it.
if ( self.PropPanel ) then return end
-- Create the container panel
self.PropPanel = vgui.Create( "ContentContainer", pnlContent )
self.PropPanel:SetVisible( false )
self.PropPanel:SetTriggerSpawnlistChange( false )
for k, ent in SortedPairsByMemberValue( v, "PrintName" ) do
spawnmenu.CreateContentIcon( ent.ScriptedEntityType or "entity", self.PropPanel, {
nicename = ent.PrintName or ent.ClassName,
spawnname = ent.SpawnName,
material = "entities/" .. ent.SpawnName .. ".png",
admin = ent.AdminOnly
} )
end
end
-- If we click on the node populate it and switch to it.
node.DoClick = function( self )
self:DoPopulate()
pnlContent:SwitchPanel( self.PropPanel )
end
end
-- Select the first node
local FirstNode = tree:Root():GetChildNode( 0 )
if ( IsValid( FirstNode ) ) then
FirstNode:InternalDoClick()
end
end )
spawnmenu.AddCreationTab( "#spawnmenu.category.customtab", function()
local ctrl = vgui.Create( "SpawnmenuContentPanel" )
ctrl:CallPopulateHook( "PopulateCustomTab" )
return ctrl
end, "icon16/bricks.png", 20 )[/CODE]
So, I found this I edited it, but now how to add Items... Its using a LIST, how do I add entities?
[editline]31st August 2016[/editline]
Oh and I added list.add at the top..
Sorry, you need to Log In to post a reply to this thread.