From d5a30b948eebf7f5f14ce06e3ca8dfb2e5fe7020 Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Fri, 26 May 2023 22:32:12 +0500 Subject: [PATCH] small changes --- .../beatrun/gamemode/cl/OnlineCourse.lua | 29 +++++++------------ .../beatrun/gamemode/sh/Menu_Gamemodes.lua | 24 ++++++++------- 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/OnlineCourse.lua b/beatrun/gamemodes/beatrun/gamemode/cl/OnlineCourse.lua index 9ff3c62..b0f9416 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/OnlineCourse.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/OnlineCourse.lua @@ -8,12 +8,13 @@ function UploadCourse() local filedata = util.Decompress(file:Read(file:Size())) local function h_success(code, body, headers) - print("Response: ", code) - print("Your Share Code: ", body) + print("Response: " .. code) + print(body) end - local function h_failed(reason) - print("HTTP failed: ", reason) + local function h_failed(code, body) + print("Response: " .. code) + print(body) end local h_method = "POST" @@ -22,11 +23,11 @@ function UploadCourse() local h_body = filedata local h_headers = { + Authorization = apikey:GetString(), ["Content-Type"] = "text/plain", ["Content-Length"] = filedata:len(), ["User-Agent"] = "Valve/Steam HTTP Client 1.0 (4000)", ["Accept-Encoding"] = "gzip", - Authorization = apikey:GetString(), ["Game-Map"] = game.GetMap() } @@ -43,21 +44,10 @@ end concommand.Add("Beatrun_UploadCourse", UploadCourse) -local GetCourse_Errors = { - ["Not valid map"] = "Error: You are not playing on the map this course was intended for.", - ["Not valid share code"] = "Error: The share code provided is invalid.", - ["Not valid key"] = "Plese message @Jonny_Bro#4226 for a key.", - ["Ratelimited"] = "You are ratelimited, please try again later!" -} - function GetCourse(sharecode) http.Fetch("http://" .. domain:GetString() .. "/getcourse.php?sharecode=" .. sharecode .. "&map=" .. game.GetMap() .. "&key=" .. apikey:GetString(), function(body, length, headers, code) - local errorcode = GetCourse_Errors[body] - - print(body) - - if not errorcode then - print("Success! | Response:", code, "Length:", length) + if code == 200 then + print("Success! | Response: " .. code .. " | Length: " .. length) print("Loading course...") PrintTable(headers) @@ -66,7 +56,8 @@ function GetCourse(sharecode) return true else - print(errorcode) + print("Error! | Response: " .. code) + print(body) return false end diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Menu_Gamemodes.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Menu_Gamemodes.lua index 55afed7..cceb184 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Menu_Gamemodes.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Menu_Gamemodes.lua @@ -1,3 +1,9 @@ +hook.Add("PlayerButtonDown", "GMMenuBind", function(ply, button) + if (game.SinglePlayer() or CLIENT and IsFirstTimePredicted()) and button == KEY_F3 then + ply:ConCommand("Beatrun_GMMenu") + end +end) + if CLIENT then local gamemodePanel = { w = 1200, @@ -95,13 +101,15 @@ if CLIENT then AEUI:AddPanel(weaponsList) for _, v in pairs(weapons.GetList()) do - local weaponentry = AEUI:AddText(weaponsList, v.ClassName, "AEUILarge", 10, 40 * #weaponsList.elements) + if not string.find(v.ClassName:lower(), "base") then + local weaponentry = AEUI:AddText(weaponsList, v.ClassName, "AEUILarge", 10, 40 * #weaponsList.elements) - function weaponentry:onclick() - LocalPlayer():EmitSound("buttonclick.wav") + function weaponentry:onclick() + LocalPlayer():EmitSound("buttonclick.wav") + end + + weaponentry.greyed = isSA() end - - weaponentry.greyed = sacheck end end @@ -111,12 +119,6 @@ if CLIENT then end) concommand.Add("Beatrun_GMMenu", OpenGMMenu) - - hook.Add("PlayerButtonDown", "GMMenuBind", function(ply, button) - if (game.SinglePlayer() or CLIENT and IsFirstTimePredicted()) and button == KEY_F3 then - ply:ConCommand("Beatrun_GMMenu") - end - end) end if SERVER then