Hide Spawn Menu Tabs From Users

Basically, I was wondering how you could disguise tabs in the spawn menu from users like the entities tab or weapons tab. However, make them visible for admins.

I have looked up threads like these in the past and I found this one http://forum.facepunch.com/showthread.php?t=1284904

I tried robotboy’s code out and it did what it was intended to do however it disguised the tabs for everyone and not just users


local function removeOldTabls()
	for k, 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.entities") or 
			v.Tab:GetText() == language.GetPhrase("spawnmenu.category.weapons") or 
			v.Tab:GetText() == language.GetPhrase("spawnmenu.category.vehicles") or 
			v.Tab:GetText() == language.GetPhrase("spawnmenu.category.postprocess") ) then
			g_SpawnMenu.CreateMenu:CloseTab( v.Tab, true )
		end
	end
end

hook.Add( "PopulateContent", "rb655_", function( pnlContent, tree, node )
	removeOldTabls()
end )

Why do you want to hide them anyway, it’s not like that will stop anyone from spawning entities.

Because, for a project I’m developing there are a majority of entities that need to remain unseen from regular players. It’s a hard thing to explain its just the entity tab needs to remain unseen from normal players.

Just do not add those entities to the spawnmenu, assuming they are of your authorship?
Simply add ENT.Spawnable = false to the entity’s code.

Yes they’re of my authorship. What I’m trying to accomplish is admins can still easily spawn in the entities but the players can’t see them in the entities tab because if they can it would defeat the purpose of the gamemode.

What you can do is just add the icons only for admins.

I am not sure however if it will allow you to spawn with ENT.Spawnable = false, you should test that.

Alright thanks for your help Robotboy (well for your original code) I just made an adjustment

for those of you who are wondering


if (LocalPlayer():IsUserGroup("user") == true) then
local function removeOldTabls()
	for k, 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.entities") or 
			v.Tab:GetText() == language.GetPhrase("spawnmenu.category.weapons") or 
			v.Tab:GetText() == language.GetPhrase("spawnmenu.category.vehicles") or 
			v.Tab:GetText() == language.GetPhrase("spawnmenu.category.postprocess") ) then
			g_SpawnMenu.CreateMenu:CloseTab( v.Tab, true )
		end
	end
end

hook.Add( "PopulateContent", "rb655_", function( pnlContent, tree, node )
	removeOldTabls()
end )