Hiding the tool tabs in the spawn menu

Hello facepunch, so I have a question, I found code for hiding normal tabs in the spawn menu for non-admins but I also want to hide the two of the 3 tool tabs for non-admins too. Here is the code for the tabs:


local function removeOldTabls()

local tabstoremove = {language.GetPhrase("spawnmenu.category.npcs"),
language.GetPhrase("spawnmenu.category.entities"),
language.GetPhrase("spawnmenu.category.weapons"),
language.GetPhrase("spawnmenu.category.vehicles"),
language.GetPhrase("spawnmenu.category.postprocess"),
language.GetPhrase("spawnmenu.category.dupes"),
language.GetPhrase("spawnmenu.category.saves")}
if !LocalPlayer():IsAdmin() then
	for k, v in pairs( g_SpawnMenu.CreateMenu.Items ) do
		 if table.HasValue(tabstoremove, v.Tab:GetText()) then
			g_SpawnMenu.CreateMenu:CloseTab( v.Tab, true )
			removeOldTabls()
		end
	end
end
end


hook.Add("SpawnMenuOpen", "blockmenutabs", removeOldTabls)

I was thinking it might have been


language.GetPhrase("toolmenu.category.options"),

but it didn’t work so I am stumped

Also is it possible so that if they are an admin it would readd the tabs without actually reconnecting to the server?
(I was thinking something like this


g_SpawnMenu.CreateMenu:OpenTab

but of course it’s not that)

Thanks for reading :slight_smile:

– Tyler

When I was trying to hide tabs in the spawnmenu for a gamemode I ended up dropping, I wound up just overriding the

spawnmenu.GetCreationTabs function to remove tabs I didn’t want, and then reloaded the spawnmenu by running


spawnmenu_reload

There might be better spots to stop the spawnmenu tabs from opening, but doing it that way worked for me.

Also, if you don’t want people to spawn the props, you should still block them with the SANDBOX:PlayerSpawn… functions, even if you’re removing the tabs.

-Clarification: spawnmenu_reload is a concommand.

I am sorry… I have no idea how to even start with the tool tabs stuff like you said withe the spawnmenu.GetCreationTabs I was thinking maybe you meant something like this


if spawnmenu.GetToolMenu( "Main" ) then 
g_SpawnMenu.CreateMenu:CloseTab()
end

but other than that guess, I have no idea how. Is there anyway I can get an example? (I learn better by example)

Bump Due to the fact that I can’t figure it out, I hope someone out there knows how, if not, sorry for bumping this, I really don’t want to be one of those people who wants everything spoon feed to them, but I just have no idea how to even start.

Bump Been a few days now, still can’t figure it out, I hate bumping threads but I really need help with this.

use print()'s and printtable()'s to find out whats in the tables.
also you’ve made an infinite loop in your code there.