Hiding default menu tabs

Hi. I need to hide certain tabs in the spawn menu from some usergroups but I can’t hide tabs even for myself.
I try to using methods described in this threads but it doesn’t work for me:
http://forum.facepunch.com/showthread.php?t=1284904
http://forum.facepunch.com/showthread.php?t=1227463

Maybe I just pastes this code to wrong places? Where is right place? /lua/autorun/client ?
Thanks in advance

UPD. Why tabs doesn’t close?

http://forum.facepunch.com/showthread.php?t=1483637

seems this has been addressed in a ton of locations lol this works for me though

[editline]2nd September 2015[/editline]

i have it close on menu open instead of when populating the menu, i dont know if that has anything to do with it

[editline]2nd September 2015[/editline]

[lua]local function removeOldTabls()
if LocalPlayer():IsUserGroup(“superadmin”) then
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”) 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 )
removeOldTabls()
end
end
end
end
hook.Add(“SpawnMenuOpen”, “blockmenutabs”, removeOldTabls)

[/lua]

[editline]2nd September 2015[/editline]

also if you dont have a bit of a loop in there it likes to only remove one or 2 tabs

[lua] g_SpawnMenu.CreateMenu:CloseTab( v.Tab, true )
removeOldTabls()[/lua]

Big thanks dude!