Select tempchar and tempactive in settings

This commit is contained in:
Fesiug 2024-01-08 03:39:33 -05:00
parent 9779bf5b48
commit 5ad4abd377
2 changed files with 69 additions and 8 deletions

View File

@ -20,6 +20,36 @@ local conf = {
{ 3, "benny_bind_reload", "Reload" },
{ 3, "benny_bind_reloada", "Reload Alt" },
},
[3] = {
{ 4, function( Scroll )
local Butt = Scroll:Add("DLabel")
Butt:Dock(TOP)
Butt:DockMargin( ss(24+4), 0, 0, 0 )
Butt:SetText( "Character Appearance" )
local Down = Scroll:Add("DComboBox")
Down:Dock( TOP )
Down:DockMargin( ss(24), 0, ss(24), ss(2) )
Down:SetValue( ConVarSV_String("tempchar") )
Down:AddChoice( "Benny", "benny" )
Down:AddChoice( "Nikki", "nikki" )
Down:AddChoice( "Igor", "igor" )
Down:AddChoice( "Yang-Hao", "yanghao" )
Down:AddChoice( "z: CIA", "mp_cia" )
Down:AddChoice( "z: PLASOF", "mp_plasof" )
Down:AddChoice( "z: MILITIA", "mp_militia" )
Down:AddChoice( "z: ARNG", "mp_natguard" )
Down:AddChoice( "z: VIPER", "mp_viper" )
Down:AddChoice( "z: HALO", "mp_halo" )
function Down:OnSelect( index, value, data )
RunConsoleCommand( "benny_tempchar", data )
RunConsoleCommand( "benny_hud_tempactive", data )
end
end },
},
}
local function genpan( Base, Sect, Conf )
@ -32,13 +62,13 @@ local function genpan( Base, Sect, Conf )
if v[1] == 0 then
local Butt = Scroll:Add("DCheckBoxLabel")
Butt:Dock(TOP)
Butt:DockMargin( 0, 2, 0, 2 )
Butt:DockMargin( 0, ss(2), 0, ss(2) )
Butt:SetText( v[3] )
Butt:SetConVar( v[2] )
elseif v[1] == 1 then
local Butt = Scroll:Add("DNumSlider")
Butt:Dock(TOP)
Butt:DockMargin( 0, 2, 0, 2 )
Butt:DockMargin( 0, ss(2), 0, ss(2) )
Butt:SetText( v[3] )
Butt:SetConVar( v[2] )
Butt:SetMin( v[4] )
@ -47,22 +77,24 @@ local function genpan( Base, Sect, Conf )
elseif v[1] == 2 then
local Butt = Scroll:Add("DLabel")
Butt:Dock(TOP)
Butt:DockMargin( 24, -5, 0, 0 )
Butt:DockMargin( ss(12), ss(-4), 0, 0 )
Butt:SetText( v[2] )
elseif v[1] == 3 then
local Butt = Scroll:Add("DLabel")
Butt:Dock(TOP)
Butt:DockMargin( 48+5, 0, 0, 0 )
Butt:DockMargin( ss(24+4), 0, 0, 0 )
Butt:SetText( v[3] )
local Butt = Scroll:Add("DBinder")
Butt:Dock(TOP)
Butt:DockMargin( 48, 0, 48, 2 )
Butt:DockMargin( ss(24), 0, ss(24), ss(2) )
Butt:SetText( v[2] )
function Butt:OnChange( num )
RunConsoleCommand( v[2], num )
end
elseif v[1] == 4 then
v[2]( Scroll )
end
end
end
@ -72,26 +104,37 @@ function OpenSettingsMenu()
local Base = vgui.Create("BFrame")
SettingsMenu = Base
Base:SetTitle("Settings")
Base:SetSize( 800, 600 )
Base:SetSize( ss(300), ss(300) )
Base:Center()
Base:MakePopup()
Base:SetKeyboardInputEnabled( false )
do -- Sect 1
local Sect = Base:Add("DCollapsibleCategory")
local Sect = Base:Add("BCollapsibleCategory")
Sect:Dock(TOP)
Sect:DockMargin( 0, 0, 0, ss(2) )
Sect:SetLabel("HUD")
genpan( Base, Sect, conf[1] )
end
do -- Sect 2
local Sect = Base:Add("DCollapsibleCategory")
local Sect = Base:Add("BCollapsibleCategory")
Sect:Dock(TOP)
Sect:DockMargin( 0, 0, 0, ss(2) )
Sect:SetLabel("Controls")
genpan( Base, Sect, conf[2] )
end
do -- Sect 3
local Sect = Base:Add("BCollapsibleCategory")
Sect:Dock(TOP)
Sect:DockMargin( 0, 0, 0, ss(2) )
Sect:SetLabel("Preferences")
genpan( Base, Sect, conf[3] )
end
end
concommand.Add("benny_ui_settings", function()

View File

@ -86,6 +86,24 @@ local bgl = {
[12] = 0,
[13] = 0,
},
["mp_cia"] = {
[0] = Vector( 1, 1, 1 )
},
["mp_plasof"] = {
[0] = Vector( 1, 1, 1 )
},
["mp_militia"] = {
[0] = Vector( 1, 1, 1 )
},
["mp_natguard"] = {
[0] = Vector( 1, 1, 1 )
},
["mp_viper"] = {
[0] = Vector( 1, 1, 1 )
},
["mp_halo"] = {
[0] = Vector( 1, 1, 1 )
},
}
function PT:MakeCharacter()