From d0cbbf06d4cd7e416223621214cdb36a4c0c80e2 Mon Sep 17 00:00:00 2001 From: Fesiug Date: Thu, 21 Dec 2023 03:50:11 -0500 Subject: [PATCH] Add firemode bar --- .../gamemode/modules/gui/cl_spawnmenu.lua | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua b/gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua index 71725a2..77a5431 100644 --- a/gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua +++ b/gamemodes/benny/gamemode/modules/gui/cl_spawnmenu.lua @@ -334,11 +334,13 @@ function OpenSMenu() fucker:Dock( TOP ) fucker:DockMargin( 0, 0, 0, ss(2) ) function fucker:Paint( w, h ) - local hm = WeaponGet( pan_active ) - surface.SetDrawColor( schema("fg") ) - surface.DrawRect( 0, 0, w, h ) + if pan_active then + local hm = WeaponGet( pan_active ) + surface.SetDrawColor( schema("fg") ) + surface.DrawRect( 0, 0, w, h ) - draw.SimpleText( BENNY_GetStat( hm, "Ammo" ) .. " rounds", "Benny_12", ss(2), ss(2), schema_c("bg") ) + draw.SimpleText( BENNY_GetStat( hm, "Ammo" ) .. " rounds", "Benny_12", ss(2), ss(2), schema_c("bg") ) + end return true end end @@ -349,27 +351,29 @@ function OpenSMenu() fucker:Dock( TOP ) fucker:DockMargin( 0, 0, 0, ss(2) ) function fucker:Paint( w, h ) - local hm = WeaponGet( pan_active ) - surface.SetDrawColor( schema("fg") ) - surface.DrawRect( 0, 0, w, h ) + if pan_active then + local hm = WeaponGet( pan_active ) + surface.SetDrawColor( schema("fg") ) + surface.DrawRect( 0, 0, w, h ) - local fm = BENNY_GetStat( hm, "Firemodes" ) - local fms = "" + local fm = BENNY_GetStat( hm, "Firemodes" ) + local fms = "" - for i,v in ipairs( fm) do - local m =v.Mode - if m == math.huge then - fms = fms .. "AUTO" - elseif m == 1 then - fms = fms .. "SEMI" - else - fms = fms .. m .. "-BURST" - end - if i != #fm then - fms = fms .. " / " + for i,v in ipairs( fm) do + local m =v.Mode + if m == math.huge then + fms = fms .. "AUTO" + elseif m == 1 then + fms = fms .. "SEMI" + else + fms = fms .. m .. "-BURST" + end + if i != #fm then + fms = fms .. " / " + end end + draw.SimpleText( fms, "Benny_12", ss(2), ss(2), schema_c("bg") ) end - draw.SimpleText( fms, "Benny_12", ss(2), ss(2), schema_c("bg") ) return true end end