local COLOR_MAIN local COLOR_DARK local function qpaint( self, w, h ) surface.SetDrawColor( COLOR_DARK ) surface.DrawRect( 0, 0, w, h ) surface.SetDrawColor( COLOR_MAIN ) surface.DrawOutlinedRect( 1, 1, w-2, h-2, 1 ) draw.SimpleText( self.text, "HUD_24", w/2, 6, COLOR_MAIN, TEXT_ALIGN_CENTER ) end local settings = { { name = "Camera", items = { { type = TYPE_BOOL, cvar = "b-cam_fp", name = "First-person Mode" }, { type = TYPE_NUMBER, cvar = "b-cam_f", min = -200, max = 200, name = "Camera Forward" }, { type = TYPE_NUMBER, cvar = "b-cam_r", min = -30, max = 30, name = "Camera Right" }, { type = TYPE_NUMBER, cvar = "b-cam_u", min = -30, max = 30, name = "Camera Up" }, { type = TYPE_NUMBER, cvar = "b-cam_fov", min = 1, max = 140, name = "Camera FOV" }, } }, { name = "Gameplay", items = { } }, } local entries = { { name = "RESUME", DoClick = function( self ) PauseMenu:Remove() end, }, { name = "LOADOUTS", DoClick = function( self ) PauseMenu:Remove() end, }, { name = "CHANGE TEAM", DoClick = function( self ) PauseMenu:Remove() OpenMyTeamMenu() end, }, { name = "SETTINGS", DoClick = function( self ) if SettingsMenu and SettingsMenu:IsValid() then SettingsMenu:Remove() return end SettingsMenu = vgui.Create("EditablePanel") SettingsMenu:SetSize( 300, 500 ) SettingsMenu:NoClipping( true ) function SettingsMenu:Paint( w, h ) surface.SetDrawColor( COLOR_DARK ) surface.DrawRect( 0, 0, w, h ) surface.SetDrawColor( COLOR_MAIN ) surface.DrawOutlinedRect( 1, 1, w-2, h-2, 1 ) end SettingsMenu:DockPadding( 10, 10, 10, 10 ) function SettingsMenu:PerformLayout( w, h ) local x, y, w, h = PauseMenu:GetBounds() self:SetPos( x + w + 10, y ) end local SP = SettingsMenu:Add("DScrollPanel") SP:Dock(FILL) for index, data in ipairs( settings ) do local Cat = SettingsMenu:Add("DCollapsibleCategory") Cat:SetLabel(data.name) Cat:Dock(TOP) SP:AddItem(Cat) for index, data in ipairs( data.items ) do if !data.cvarpointer then data.cvarpointer = GetConVar(data.cvar) end if data.type == TYPE_BOOL then local Changer = vgui.Create("DCheckBoxLabel", Cat) Changer:Dock( TOP ) Changer:SetConVar( data.cvar ) Changer:SetText( data.name ) elseif data.type == TYPE_NUMBER then local Changer = vgui.Create("DNumSlider", Cat) Changer:Dock( TOP ) Changer:SetConVar( data.cvar ) Changer:SetText( data.name ) Changer:SetMin( data.min ) Changer:SetMax( data.max ) Changer:SetDecimals( 0 ) Changer:SetDefaultValue( data.cvarpointer:GetDefault() ) end end end end, }, { name = "QUIT", DoClick = function( self ) PauseMenu:Remove() end, }, } local function StartPauseMenu() if PauseMenu and PauseMenu:IsValid() then PauseMenu:Remove() return end PauseMenu = vgui.Create("EditablePanel") PauseMenu:SetSize( 300, 500 ) PauseMenu:SetPos( 100, ScrH() - 500 - 100 ) PauseMenu:MakePopup() local p = LocalPlayer() local myteam = p:Team() local MP = BennyGame:GetType() == BG_GTYPE_MP local CURRCHAR if BennyGame:GetType() == BG_GTYPE_CAMPAIGN then CURRCHAR = "benny" else CURRCHAR = TEAMS[myteam].factionid end COLOR_MAIN = FACTIONS[CURRCHAR].COLOR_MAIN COLOR_DARK = FACTIONS[CURRCHAR].COLOR_DARK local CHARNAME = FACTIONS[CURRCHAR].CHARNAME function PauseMenu:Paint( w, h ) surface.SetDrawColor( COLOR_DARK ) surface.DrawRect( 0, 0, w, h ) surface.SetDrawColor( COLOR_MAIN ) surface.DrawOutlinedRect( 1, 1, w-2, h-2, 1 ) end PauseMenu:DockPadding( 10, 10, 10, 10 ) function PauseMenu:OnRemove() if SettingsMenu and SettingsMenu:IsValid() then SettingsMenu:Remove() end end for index, data in ipairs( entries ) do local button = PauseMenu:Add("DButton") button:Dock(TOP) button:DockMargin( 0, 0, 0, 10 ) button:SetText( "" ) button:SetTall( 32 ) button.text = data.name button.Paint = qpaint button.DoClick = data.DoClick end end function GM:OnPauseMenuShow() StartPauseMenu() return false end