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")
local version_text = "v" .. VERSIONGLOBAL
local version_text = "v" .. VERSION_GLOBAL
local tw, _ = surface.GetTextSize(version_text)
surface.SetTextColor(255, 255, 255, 20)
surface.SetTextPos(scrw - tw, 0)
surface.DrawText(version_text)
surface.SetFont("BeatrunHUD")
if VERSIONGLOBAL ~= VERSIONLATEST then
if VERSION_GLOBAL ~= VERSION_LATEST then
local update_text = "Update available!"
local notlatest_w, _ = surface.GetTextSize(update_text)
surface.SetTextColor(255, 255, 255, 30)

View file

@ -8,125 +8,140 @@ local size = 35
local function ShowKeyStrokes()
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
if LocalPlayer():KeyDown(IN_FORWARD) then
surface.SetDrawColor(color_white_t)
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
surface.SetDrawColor(color_black_t)
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
-- Key E
if LocalPlayer():KeyDown(IN_USE) then
surface.SetDrawColor(color_white_t)
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
surface.SetDrawColor(color_black_t)
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
-- Key R
if LocalPlayer():KeyDown(IN_RELOAD) then
surface.SetDrawColor(color_white_t)
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
surface.SetDrawColor(color_black_t)
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
-- Key A
if LocalPlayer():KeyDown(IN_MOVELEFT) then
surface.SetDrawColor(color_white_t)
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
surface.SetDrawColor(color_black_t)
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
-- Key S
if LocalPlayer():KeyDown(IN_BACK) then
surface.SetDrawColor(color_white_t)
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
surface.SetDrawColor(color_black_t)
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
-- Key D
if LocalPlayer():KeyDown(IN_MOVERIGHT) then
surface.SetDrawColor(color_white_t)
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
surface.SetDrawColor(color_black_t)
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
-- Space
if LocalPlayer():KeyDown(IN_JUMP) then
surface.SetDrawColor(color_white_t)
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
surface.SetDrawColor(color_black_t)
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
-- Shift
if LocalPlayer():KeyDown(IN_SPEED) then
surface.SetDrawColor(color_white_t)
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
surface.SetDrawColor(color_black_t)
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
-- Ctrl
if LocalPlayer():KeyDown(IN_DUCK) then
surface.SetDrawColor(color_white_t)
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
surface.SetDrawColor(color_black_t)
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
-- Left Mouse
if LocalPlayer():KeyDown(IN_ATTACK) then
surface.SetDrawColor(color_white_t)
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
surface.SetDrawColor(color_black_t)
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
-- Right Mouse
if LocalPlayer():KeyDown(IN_ATTACK2) then
surface.SetDrawColor(color_white_t)
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
surface.SetDrawColor(color_black_t)
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

View file

@ -1,5 +1,6 @@
VERSIONGLOBAL = "1.0.13"
VERSIONLATEST = ""
VERSION_GLOBAL = "1.0.14"
VERSION_LATEST = ""
VERSION_CHECKED = false
DeriveGamemode("sandbox")
@ -15,12 +16,28 @@ for _, v in ipairs(file.Find("gamemodes/beatrun/gamemode/sh/*.lua", "GAME", "nam
include("sh/" .. v)
end
http.Fetch("https://raw.githubusercontent.com/JonnyBro/beatrun/main/version.txt", function(body, size, headers, code)
if not VERSION_CHECKED then
http.Fetch("https://raw.githubusercontent.com/JonnyBro/beatrun/main/version.txt", function(body, size, headers, code)
if code == 200 then
VERSIONLATEST = body:gsub("[\n\r]", "")
VERSION_LATEST = body:gsub("[\n\r]", "")
print("Latest version: " .. VERSION_LATEST)
if VERSION_LATEST > VERSION_GLOBAL then
print("Your version is behind latest, please update.")
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, function(e)
print("Error while checking version (error on fetch):\n" .. e)
end)
end)
end

View file

@ -1 +1 @@
1.0.13
1.0.14