mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-28 12:53: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 filedata = util.Decompress(file:Read(file:Size()))
|
||||||
|
|
||||||
local function h_success(code, body, headers)
|
local function h_success(code, body, headers)
|
||||||
print("Response: ", code)
|
print("Response: " .. code)
|
||||||
print("Your Share Code: ", body)
|
print(body)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function h_failed(reason)
|
local function h_failed(code, body)
|
||||||
print("HTTP failed: ", reason)
|
print("Response: " .. code)
|
||||||
|
print(body)
|
||||||
end
|
end
|
||||||
|
|
||||||
local h_method = "POST"
|
local h_method = "POST"
|
||||||
|
@ -22,11 +23,11 @@ function UploadCourse()
|
||||||
local h_body = filedata
|
local h_body = filedata
|
||||||
|
|
||||||
local h_headers = {
|
local h_headers = {
|
||||||
|
Authorization = apikey:GetString(),
|
||||||
["Content-Type"] = "text/plain",
|
["Content-Type"] = "text/plain",
|
||||||
["Content-Length"] = filedata:len(),
|
["Content-Length"] = filedata:len(),
|
||||||
["User-Agent"] = "Valve/Steam HTTP Client 1.0 (4000)",
|
["User-Agent"] = "Valve/Steam HTTP Client 1.0 (4000)",
|
||||||
["Accept-Encoding"] = "gzip",
|
["Accept-Encoding"] = "gzip",
|
||||||
Authorization = apikey:GetString(),
|
|
||||||
["Game-Map"] = game.GetMap()
|
["Game-Map"] = game.GetMap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,21 +44,10 @@ end
|
||||||
|
|
||||||
concommand.Add("Beatrun_UploadCourse", UploadCourse)
|
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)
|
function GetCourse(sharecode)
|
||||||
http.Fetch("http://" .. domain:GetString() .. "/getcourse.php?sharecode=" .. sharecode .. "&map=" .. game.GetMap() .. "&key=" .. apikey:GetString(), function(body, length, headers, code)
|
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]
|
if code == 200 then
|
||||||
|
print("Success! | Response: " .. code .. " | Length: " .. length)
|
||||||
print(body)
|
|
||||||
|
|
||||||
if not errorcode then
|
|
||||||
print("Success! | Response:", code, "Length:", length)
|
|
||||||
print("Loading course...")
|
print("Loading course...")
|
||||||
|
|
||||||
PrintTable(headers)
|
PrintTable(headers)
|
||||||
|
@ -66,7 +56,8 @@ function GetCourse(sharecode)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
print(errorcode)
|
print("Error! | Response: " .. code)
|
||||||
|
print(body)
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
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
|
if CLIENT then
|
||||||
local gamemodePanel = {
|
local gamemodePanel = {
|
||||||
w = 1200,
|
w = 1200,
|
||||||
|
@ -95,13 +101,15 @@ if CLIENT then
|
||||||
AEUI:AddPanel(weaponsList)
|
AEUI:AddPanel(weaponsList)
|
||||||
|
|
||||||
for _, v in pairs(weapons.GetList()) do
|
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()
|
function weaponentry:onclick()
|
||||||
LocalPlayer():EmitSound("buttonclick.wav")
|
LocalPlayer():EmitSound("buttonclick.wav")
|
||||||
|
end
|
||||||
|
|
||||||
|
weaponentry.greyed = isSA()
|
||||||
end
|
end
|
||||||
|
|
||||||
weaponentry.greyed = sacheck
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -111,12 +119,6 @@ if CLIENT then
|
||||||
end)
|
end)
|
||||||
|
|
||||||
concommand.Add("Beatrun_GMMenu", OpenGMMenu)
|
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
|
end
|
||||||
|
|
||||||
if SERVER then
|
if SERVER then
|
||||||
|
|
Loading…
Reference in a new issue