Skip to content

Instantly share code, notes, and snippets.

@NanoAi
Last active March 28, 2018 21:27
Show Gist options
  • Save NanoAi/f63c160aadfe9febf4502fd651b27578 to your computer and use it in GitHub Desktop.
Save NanoAi/f63c160aadfe9febf4502fd651b27578 to your computer and use it in GitHub Desktop.
Remove standard spawn menu tabs from Garry's Mod. (VJ Base, included.)
local TabsModified = false
local TabsToRemove = {
["spawnmenu.category.dupes"] = 1,
["spawnmenu.category.entities"] = 1,
["spawnmenu.category.npcs"] = 1,
["spawnmenu.category.postprocess"] = 1,
["spawnmenu.category.saves"] = 1,
["spawnmenu.category.vehicles"] = 1,
["spawnmenu.category.weapons"] = 1,
["VJ Base"] = 1,
-- ["#spawnmenu.content_tab"] = 1,
}
local function DestroySpawnTabs()
local GetCreationTabs = spawnmenu.GetCreationTabs
local SpawnMenu = g_SpawnMenu.CreateMenu
for k,_ in next, TabsToRemove do
GetCreationTabs()['#'..k] = nil -- Check for both language,
GetCreationTabs()[k] = nil -- and literal definitions.
for _,v in pairs( SpawnMenu.Items ) do
if v.Tab:GetText() == k or v.Tab:GetText() == language.GetPhrase(k) then
SpawnMenu:CloseTab( v.Tab, true ) -- Due to some wierd gmod magic, the above sometimes doesn't work and vise vera.
end -- Including both for a higher chance of working.
end
end
if not TabsModified then
LocalPlayer():ConCommand('spawnmenu_reload')
TabsModified = true
end
end
hook.Add("PopulatePropMenu", "RemoveSpawnmenuTabs", DestroySpawnTabs)
LocalPlayer():ConCommand('spawnmenu_reload')
@anthonyisamodder
Copy link

Where do I put this Tenshi?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment