Hey, recently me and a friend decided to create our own gamemode, he is good at lua as in the SWEP and making the gamemode but hates doing VGUI such as HUD’s and menu’s

Before this me and another friend were experimenting with lua VGUI, aka HUD’s and menus ^^

So as he has been making the gamemode, I did a HUD that works fine, and now I’ve been working on a F3 Menu
It’s all working fine, the Property Sheets, the spinny player model, my text and all the buttons, but I wanted to make an Admin page

This page would be admin only so normal players would not see it, however it would still be on the same menu. From that I want to have a list of every players name using this selection box:

And then from there it will have every players name appear on it with a vertical scrollbar if necessary. Once a name is clicked a DMenu like this: Will appear, and instead of “Hello / How / etc.” I will have Kick / Ban / Freeze so that admins can do what they want to the player, but for a tab like Freeze, I will need a SubMenu that would have somethign like Enable / Disable

I know when you read this it seems very complicated and long, but anyone that knows derma could do this in a few minutes and then I can use your example to do what I need, so please help me :smiley:

I wonder why AddSubMenu is not documented at all…


local DermaPanel = vgui.Create( “DFrame” )
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( 200, 250 )
DermaPanel:SetTitle( “Testing Derma Stuff” )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )

local MenuButton = vgui.Create(“DButton”)
MenuButton:SetParent( DermaPanel )
MenuButton:SetText( “Menu >” )
MenuButton:SetPos(25, 50)
MenuButton:SetSize( 150, 175 )
MenuButton.DoClick = function ( btn )
local MenuButtonOptions = DermaMenu() – Creates the menu
MenuButtonOptions:AddOption(“hello”, function() Msg(“Hello”) end ) – Add options to the menu
MenuButtonOptions:AddOption(“how”, function() Msg(“How”) end )
local SubMenu=MenuButtonOption:AddSubMenu(“are”)–a submenu acts exactly like a normal DMenu
SubMenu:AddOption(“you”,function() Msg(“you”) end)
SubMenu:AddOption("?",function Msg("?") end)
MenuButtonOptions:Open() – Open the menu AFTER adding your options

Example stolen from the wiki, I just added the SubMenu part.

Cool, will test that out in a minute and will edit if it works or not

Thanks :slight_smile:


Right then, haven’t had time to test it but I just did it

Thanks a lot for the original idea and then the fix, this should work fineeeeeeeeeeeeeee

If I have anythign else, I’ll just add it so thanks :slight_smile: