--------------------- -- Your Name is Benny --------------------- if SERVER then util.AddNetworkString( "Benny_DebugMenuSpawn" ) net.Receive( "Benny_DebugMenuSpawn", function( len, ply ) if !ply:IsAdmin() then return end local ent = ents.Create( "b-item_" .. net.ReadString() ) ent:SetPos( ply:GetEyeTrace().HitPos ) ent:Spawn() end) return end local function dospawn( self ) net.Start( "Benny_DebugMenuSpawn" ) net.WriteString( self.iName ) net.SendToServer() DebugMenu:Remove() return end local function OpenDebugMenu() if IsValid(DebugMenu) then DebugMenu:Remove() end DebugMenu = vgui.Create("DFrame") DebugMenu:SetSize( 200, 500 ) DebugMenu:Center() DebugMenu:MakePopup() DebugMenu:SetKeyboardInputEnabled( false ) local opt = DebugMenu:Add("DScrollPanel") opt:Dock( FILL ) local categories = {} for iname, idata in SortedPairs( ITEMS ) do if !categories[idata.Category] then local cate = opt:Add("DCollapsibleCategory") cate:Dock(TOP) cate:SetLabel(idata.Category) local plist = vgui.Create("DPanelList") cate:SetContents(plist) categories[idata.Category] = plist end local plist = categories[idata.Category] local button = plist:Add("DButton") button:Dock( TOP ) button:DockMargin( 0, 0, 0, 0 ) button:SetText( l8( idata.PrintName ) ) button.iName = iname button.iData = idata button.DoClick = dospawn end local button = DebugMenu:Add("DButton") button:Dock( BOTTOM ) button:DockMargin( 4, 4, 4, 4 ) button:SetText( "CLOSE" ) button:SetTall( 36 ) button.DoClick = function( self ) DebugMenu:Remove() end end hook.Add("PlayerButtonDown", "PlayerButtonDown_DebugMenu", function( ply, button ) if button == KEY_F1 then OpenDebugMenu() end end) hook.Add("PlayerButtonUp", "PlayerButtonUp_DebugMenu", function( ply, button ) if button == KEY_F1 then --if IsValid(DebugMenu) then DebugMenu:Remove() end end end)