Removing the 'Dupes' tab

Hello, I’m using this lovely piece of code I found on the forums presented by Robotboy to remove tabs from the spawnmenu however the ‘Dupes’ tab does not get removed


local function BW3_Removetabs()
	for _, v in pairs( g_SpawnMenu.CreateMenu.Items ) do
		if (v.Tab:GetText() == language.GetPhrase("spawnmenu.category.npcs") or
			v.Tab:GetText() == language.GetPhrase("spawnmenu.category.postprocess") or
			v.Tab:GetText() == language.GetPhrase("spawnmenu.category.dupes") or
			v.Tab:GetText() == language.GetPhrase("spawnmenu.category.saves") ) then
			g_SpawnMenu.CreateMenu:CloseTab( v.Tab, true )
		end
	end
end
hook.Add( "PopulateContent", "BW3_RemoveTabs", BW3_Removetabs )

Any suggestions? I assume the Dupes tab is added in a different hook.

You gotta run the code multiple times ( Or try a timer ), the tab might not be created when you try to remove it.

Oh I see, I assumed the PopulateContent hook was called whenever a content tab tried to populate into the spawn menu.

I assume your trying to remove dupes from your server, I think I remember there being a file you can just delete and the dupes menu goes?

Of course you can go into the sandbox files and delete the file which corresponds to the appropriate menus, there is a right way to do things and many wrong ways, that of which is one of those wrong ways. :slight_smile:

I’m a lazy person haha

Something like


local function BW3_Removetabs()
        timer.Simple(1, function()
	for _, v in pairs( g_SpawnMenu.CreateMenu.Items ) do
		if (v.Tab:GetText() == language.GetPhrase("spawnmenu.category.npcs") or
			v.Tab:GetText() == language.GetPhrase("spawnmenu.category.postprocess") or
			v.Tab:GetText() == language.GetPhrase("spawnmenu.category.dupes") or
			v.Tab:GetText() == language.GetPhrase("spawnmenu.category.saves") ) then
			g_SpawnMenu.CreateMenu:CloseTab( v.Tab, true )
		end
	end
        end)
end
hook.Add( "PopulateContent", "BW3_Remove

Tabs", BW3_Removetabs )

PopulateContent is called when you want to add new tabs or content.