local show_letters = { { "q", "w", "e", "r", "t", "y" }, { "a", "s", "d", "f", "g", "h" }, { "shift", "z", "x", "c", "v", "b", "n" }, { "ctrl", "alt", "space" }, } local translate_letters = { ["e"] = "weapon 1", ["q"] = "weapon 2", ["c"] = "grenade 1", ["z"] = "grenade 2", ["r"] = "alt 1", ["t"] = "alt 2", ["x"] = "bullrush", ["shift"] = "speed", } local function commoncode( set ) for index, letter in ipairs( set ) do local lettercode = input.GetKeyCode( letter ) local keydown = input.IsKeyDown( lettercode ) local thecolor = keydown and COLOR_MAIN or COLOR_DARK local fakecolor = ColorAlpha( COLOR_BRIGHT, 60 ) hCol( fakecolor ) local LetterWidth = 80 local LetterGap = 4 hRect( (index-1)*(LetterWidth+4), 0, LetterWidth, 40, 2 ) hCol( thecolor ) hORect( (index-1)*(LetterWidth+4), 0, LetterWidth, 40, 2 ) local x, y = hXY( (index-1)*(LetterWidth+4) + LetterWidth/2, 20+3 ) draw.SimpleText( letter:upper(), "HUD_36", x, y, thecolor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) local tlated = translate_letters[letter] if tlated then local x, y = hXY( (index-1)*(LetterWidth+4) + LetterWidth/2, 20 + 6 ) draw.SimpleText( tlated, "HUD_16", x, y, thecolor, TEXT_ALIGN_CENTER ) end end end hook.Add( "HUDPaint", "Benny_HUDPaint_KeyboardOverlay", function() --if false then return end local p = LocalPlayer() local myteam = p:Team() local CURRCHAR if BennyGame:GetType() == BG_GTYPE_CAMPAIGN then CURRCHAR = "benny" else CURRCHAR = TEAMS[myteam].factionid end local COLOR_MAIN = FACTIONS[CURRCHAR].COLOR_MAIN local COLOR_DARK = FACTIONS[CURRCHAR].COLOR_DARK local CHARNAME = FACTIONS[CURRCHAR].CHARNAME stack = util.Stack() S_Push( 100, h - 300 ) S_Push( 0, 0 ) commoncode( show_letters[1] ) S_Pop() S_Push( 18, 40+4 ) commoncode( show_letters[2] ) S_Pop() S_Push( 18+24 - (40+24), 40+4+40+4 ) commoncode( show_letters[3] ) S_Pop() S_Push( 0, 40+4+40+4+40+4 ) commoncode( show_letters[4] ) S_Pop() S_Pop() if stack:Size() != 0 then print("Stack unfinished: KeyboardOverlay") end end)