mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-27 20:43:02 +05:00
small changes
This commit is contained in:
parent
cd5367f72f
commit
d5a30b948e
2 changed files with 23 additions and 30 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue