lookup keybinds for keystrokes

This commit is contained in:
Jonny_Bro (Nikita) 2024-09-14 18:19:54 +05:00
parent 7cba7cf9e7
commit 3418007f8e
No known key found for this signature in database
GPG key ID: 3F1ECC04147E9BD8
4 changed files with 68 additions and 36 deletions

View file

@ -131,14 +131,14 @@ local function BeatrunHUD()
surface.SetFont("DebugFixedSmall") surface.SetFont("DebugFixedSmall")
local version_text = "v" .. VERSIONGLOBAL local version_text = "v" .. VERSION_GLOBAL
local tw, _ = surface.GetTextSize(version_text) local tw, _ = surface.GetTextSize(version_text)
surface.SetTextColor(255, 255, 255, 20) surface.SetTextColor(255, 255, 255, 20)
surface.SetTextPos(scrw - tw, 0) surface.SetTextPos(scrw - tw, 0)
surface.DrawText(version_text) surface.DrawText(version_text)
surface.SetFont("BeatrunHUD") surface.SetFont("BeatrunHUD")
if VERSIONGLOBAL ~= VERSIONLATEST then if VERSION_GLOBAL ~= VERSION_LATEST then
local update_text = "Update available!" local update_text = "Update available!"
local notlatest_w, _ = surface.GetTextSize(update_text) local notlatest_w, _ = surface.GetTextSize(update_text)
surface.SetTextColor(255, 255, 255, 30) surface.SetTextColor(255, 255, 255, 30)

View file

@ -8,125 +8,140 @@ local size = 35
local function ShowKeyStrokes() local function ShowKeyStrokes()
if showKeystrokes:GetBool() and GetConVar("Beatrun_HUDHidden"):GetInt() == 0 then if showKeystrokes:GetBool() and GetConVar("Beatrun_HUDHidden"):GetInt() == 0 then
local forward = string.upper(input.LookupBinding("+forward"))
local back = string.upper(input.LookupBinding("+back"))
local moveleft = string.upper(input.LookupBinding("+moveleft"))
local moveright = string.upper(input.LookupBinding("+moveright"))
local use = string.upper(input.LookupBinding("+use"))
local reload = string.upper(input.LookupBinding("+reload"))
local jump = string.upper(input.LookupBinding("+jump"))
local speed = string.upper(input.LookupBinding("+speed"))
local duck = string.upper(input.LookupBinding("+duck"))
local attack = string.upper(input.LookupBinding("+attack"))
local attack2 = string.upper(input.LookupBinding("+attack2"))
if attack == "MOUSE1" then attack = "LMB" end
if attack2 == "MOUSE2" then attack2 = "RMB" end
-- Key W -- Key W
if LocalPlayer():KeyDown(IN_FORWARD) then if LocalPlayer():KeyDown(IN_FORWARD) then
surface.SetDrawColor(color_white_t) surface.SetDrawColor(color_white_t)
surface.DrawRect(size, 0, size, size) surface.DrawRect(size, 0, size, size)
draw.SimpleText("W", "BeatrunHUD", size + 10, size - 30, color_black) draw.SimpleText(forward, "BeatrunHUD", size + 10, size - 30, color_black)
else else
surface.SetDrawColor(color_black_t) surface.SetDrawColor(color_black_t)
surface.DrawRect(size, 0, size, size) surface.DrawRect(size, 0, size, size)
draw.SimpleText("W", "BeatrunHUD", size + 10, size - 30, color_white) draw.SimpleText(forward, "BeatrunHUD", size + 10, size - 30, color_white)
end end
-- Key E -- Key E
if LocalPlayer():KeyDown(IN_USE) then if LocalPlayer():KeyDown(IN_USE) then
surface.SetDrawColor(color_white_t) surface.SetDrawColor(color_white_t)
surface.DrawRect(size * 2, 0, size, size) surface.DrawRect(size * 2, 0, size, size)
draw.SimpleText("E", "BeatrunHUD", size + 48, size - 30, color_black) draw.SimpleText(use, "BeatrunHUD", size + 48, size - 30, color_black)
else else
surface.SetDrawColor(color_black_t) surface.SetDrawColor(color_black_t)
surface.DrawRect(size * 2, 0, size, size) surface.DrawRect(size * 2, 0, size, size)
draw.SimpleText("E", "BeatrunHUD", size + 48, size - 30, color_white) draw.SimpleText(use, "BeatrunHUD", size + 48, size - 30, color_white)
end end
-- Key R -- Key R
if LocalPlayer():KeyDown(IN_RELOAD) then if LocalPlayer():KeyDown(IN_RELOAD) then
surface.SetDrawColor(color_white_t) surface.SetDrawColor(color_white_t)
surface.DrawRect(size * 3, 0, size, size) surface.DrawRect(size * 3, 0, size, size)
draw.SimpleText("R", "BeatrunHUD", size * 3 + 12, size - 30, color_black) draw.SimpleText(reload, "BeatrunHUD", size * 3 + 12, size - 30, color_black)
else else
surface.SetDrawColor(color_black_t) surface.SetDrawColor(color_black_t)
surface.DrawRect(size * 3, 0, size, size) surface.DrawRect(size * 3, 0, size, size)
draw.SimpleText("R", "BeatrunHUD", size * 3 + 12, size - 30, color_white) draw.SimpleText(reload, "BeatrunHUD", size * 3 + 12, size - 30, color_white)
end end
-- Key A -- Key A
if LocalPlayer():KeyDown(IN_MOVELEFT) then if LocalPlayer():KeyDown(IN_MOVELEFT) then
surface.SetDrawColor(color_white_t) surface.SetDrawColor(color_white_t)
surface.DrawRect(0, size, size, size) surface.DrawRect(0, size, size, size)
draw.SimpleText("A", "BeatrunHUD", size - 23, size + 8, color_black) draw.SimpleText(moveleft, "BeatrunHUD", size - 23, size + 8, color_black)
else else
surface.SetDrawColor(color_black_t) surface.SetDrawColor(color_black_t)
surface.DrawRect(0, size, size, size) surface.DrawRect(0, size, size, size)
draw.SimpleText("A", "BeatrunHUD", size - 23, size + 8, color_white) draw.SimpleText(moveleft, "BeatrunHUD", size - 23, size + 8, color_white)
end end
-- Key S -- Key S
if LocalPlayer():KeyDown(IN_BACK) then if LocalPlayer():KeyDown(IN_BACK) then
surface.SetDrawColor(color_white_t) surface.SetDrawColor(color_white_t)
surface.DrawRect(size, size, size, size) surface.DrawRect(size, size, size, size)
draw.SimpleText("S", "BeatrunHUD", size + 12, size + 8, color_black) draw.SimpleText(back, "BeatrunHUD", size + 12, size + 8, color_black)
else else
surface.SetDrawColor(color_black_t) surface.SetDrawColor(color_black_t)
surface.DrawRect(size, size, size, size) surface.DrawRect(size, size, size, size)
draw.SimpleText("S", "BeatrunHUD", size + 12, size + 8, color_white) draw.SimpleText(back, "BeatrunHUD", size + 12, size + 8, color_white)
end end
-- Key D -- Key D
if LocalPlayer():KeyDown(IN_MOVERIGHT) then if LocalPlayer():KeyDown(IN_MOVERIGHT) then
surface.SetDrawColor(color_white_t) surface.SetDrawColor(color_white_t)
surface.DrawRect(size * 2, size, size, size) surface.DrawRect(size * 2, size, size, size)
draw.SimpleText("D", "BeatrunHUD", size + 48, size + 8, color_black) draw.SimpleText(moveright, "BeatrunHUD", size + 48, size + 8, color_black)
else else
surface.SetDrawColor(color_black_t) surface.SetDrawColor(color_black_t)
surface.DrawRect(size * 2, size, size, size) surface.DrawRect(size * 2, size, size, size)
draw.SimpleText("D", "BeatrunHUD", size + 48, size + 8, color_white) draw.SimpleText(moveright, "BeatrunHUD", size + 48, size + 8, color_white)
end end
-- Space -- Space
if LocalPlayer():KeyDown(IN_JUMP) then if LocalPlayer():KeyDown(IN_JUMP) then
surface.SetDrawColor(color_white_t) surface.SetDrawColor(color_white_t)
surface.DrawRect(0, size * 2, size * 3, size) surface.DrawRect(0, size * 2, size * 3, size)
draw.SimpleText("SPACE", "BeatrunHUD", 28, size * 2 + 8, color_black) draw.SimpleText(jump, "BeatrunHUD", 28, size * 2 + 8, color_black)
else else
surface.SetDrawColor(color_black_t) surface.SetDrawColor(color_black_t)
surface.DrawRect(0, size * 2, size * 3, size) surface.DrawRect(0, size * 2, size * 3, size)
draw.SimpleText("SPACE", "BeatrunHUD", 28, size * 2 + 8, color_white) draw.SimpleText(jump, "BeatrunHUD", 28, size * 2 + 8, color_white)
end end
-- Shift -- Shift
if LocalPlayer():KeyDown(IN_SPEED) then if LocalPlayer():KeyDown(IN_SPEED) then
surface.SetDrawColor(color_white_t) surface.SetDrawColor(color_white_t)
surface.DrawRect(0, size * 3, size * 3, size) surface.DrawRect(0, size * 3, size * 3, size)
draw.SimpleText("SHIFT", "BeatrunHUD", 28, size * 3 + 8, color_black) draw.SimpleText(speed, "BeatrunHUD", 28, size * 3 + 8, color_black)
else else
surface.SetDrawColor(color_black_t) surface.SetDrawColor(color_black_t)
surface.DrawRect(0, size * 3, size * 3, size) surface.DrawRect(0, size * 3, size * 3, size)
draw.SimpleText("SHIFT", "BeatrunHUD", 28, size * 3 + 8, color_white) draw.SimpleText(speed, "BeatrunHUD", 28, size * 3 + 8, color_white)
end end
-- Ctrl -- Ctrl
if LocalPlayer():KeyDown(IN_DUCK) then if LocalPlayer():KeyDown(IN_DUCK) then
surface.SetDrawColor(color_white_t) surface.SetDrawColor(color_white_t)
surface.DrawRect(0, size * 4, size * 3, size) surface.DrawRect(0, size * 4, size * 3, size)
draw.SimpleText("CTRL", "BeatrunHUD", 32, size * 4 + 8, color_black) draw.SimpleText(duck, "BeatrunHUD", 32, size * 4 + 8, color_black)
else else
surface.SetDrawColor(color_black_t) surface.SetDrawColor(color_black_t)
surface.DrawRect(0, size * 4, size * 3, size) surface.DrawRect(0, size * 4, size * 3, size)
draw.SimpleText("CTRL", "BeatrunHUD", 32, size * 4 + 8, color_white) draw.SimpleText(duck, "BeatrunHUD", 32, size * 4 + 8, color_white)
end end
-- Left Mouse -- Left Mouse
if LocalPlayer():KeyDown(IN_ATTACK) then if LocalPlayer():KeyDown(IN_ATTACK) then
surface.SetDrawColor(color_white_t) surface.SetDrawColor(color_white_t)
surface.DrawRect(size * 3, size, size * 2, size) surface.DrawRect(size * 3, size, size * 2, size)
draw.SimpleText("LMB", "BeatrunHUD", size + 87, size + 8, color_black) draw.SimpleText(attack, "BeatrunHUD", size + 87, size + 8, color_black)
else else
surface.SetDrawColor(color_black_t) surface.SetDrawColor(color_black_t)
surface.DrawRect(size * 3, size, size * 2, size) surface.DrawRect(size * 3, size, size * 2, size)
draw.SimpleText("LMB", "BeatrunHUD", size + 87, size + 8, color_white) draw.SimpleText(attack, "BeatrunHUD", size + 87, size + 8, color_white)
end end
-- Right Mouse -- Right Mouse
if LocalPlayer():KeyDown(IN_ATTACK2) then if LocalPlayer():KeyDown(IN_ATTACK2) then
surface.SetDrawColor(color_white_t) surface.SetDrawColor(color_white_t)
surface.DrawRect(size * 3, size * 2, size * 2, size) surface.DrawRect(size * 3, size * 2, size * 2, size)
draw.SimpleText("RMB", "BeatrunHUD", size + 86, size * 2 + 8, color_black) draw.SimpleText(attack2, "BeatrunHUD", size + 86, size * 2 + 8, color_black)
else else
surface.SetDrawColor(color_black_t) surface.SetDrawColor(color_black_t)
surface.DrawRect(size * 3, size * 2, size * 2, size) surface.DrawRect(size * 3, size * 2, size * 2, size)
draw.SimpleText("RMB", "BeatrunHUD", size + 86, size * 2 + 8, color_white) draw.SimpleText(attack2, "BeatrunHUD", size + 86, size * 2 + 8, color_white)
end end
end end
end end

View file

@ -1,5 +1,6 @@
VERSIONGLOBAL = "1.0.13" VERSION_GLOBAL = "1.0.14"
VERSIONLATEST = "" VERSION_LATEST = ""
VERSION_CHECKED = false
DeriveGamemode("sandbox") DeriveGamemode("sandbox")
@ -15,12 +16,28 @@ for _, v in ipairs(file.Find("gamemodes/beatrun/gamemode/sh/*.lua", "GAME", "nam
include("sh/" .. v) include("sh/" .. v)
end end
http.Fetch("https://raw.githubusercontent.com/JonnyBro/beatrun/main/version.txt", function(body, size, headers, code) if not VERSION_CHECKED then
if code == 200 then http.Fetch("https://raw.githubusercontent.com/JonnyBro/beatrun/main/version.txt", function(body, size, headers, code)
VERSIONLATEST = body:gsub("[\n\r]", "") if code == 200 then
else VERSION_LATEST = body:gsub("[\n\r]", "")
print("Error while checking version (not 200 code):\n" .. body) print("Latest version: " .. VERSION_LATEST)
end
end, function(e) if VERSION_LATEST > VERSION_GLOBAL then
print("Error while checking version (error on fetch):\n" .. e) print("Your version is behind latest, please update.")
end) elseif VERSION_LATEST == VERSION_GLOBAL then
print("You're up to date, nice!")
else
print("Your version is ahead of latest. Huh?")
end
VERSION_CHECKED = true
return
else
print("Error while checking version (not 200 code):\n" .. body)
VERSION_CHECKED = true
return
end
end)
end

View file

@ -1 +1 @@
1.0.13 1.0.14