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:
[url]http://facepunch.com/showthread.php?t=1284904[/url]
[url]http://facepunch.com/showthread.php?t=1227463[/url]
Maybe I just pastes this code to wrong places? Where is right place? /lua/autorun/client ?
Thanks in advance
[B]UPD[/B]. Why tabs doesn't close?
[IMG]https://pp.vk.me/c622229/v622229381/4485e/Nm4WLwU6i80.jpg[/IMG]
[IMG]https://pp.vk.me/c622229/v622229381/44856/hUzG1nf9Ox0.jpg[/IMG]
[url]http://facepunch.com/showthread.php?t=1483637[/url]
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]
[QUOTE=kulcris;48600242][url]http://facepunch.com/showthread.php?t=1483637[/url]
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][/QUOTE]
Big thanks dude!
[IMG]https://pp.vk.me/c622229/v622229381/44906/vfrdAY9MPLM.jpg[/IMG]
Sorry, you need to Log In to post a reply to this thread.