fix version checking

This commit is contained in:
Jonny_Bro (Nikita) 2024-09-02 17:42:06 +05:00
parent 810ddfe3da
commit 6169712625
No known key found for this signature in database
GPG key ID: 3F1ECC04147E9BD8
4 changed files with 16 additions and 20 deletions

View file

@ -138,7 +138,7 @@ local function BeatrunHUD()
surface.DrawText(version_text)
surface.SetFont("BeatrunHUD")
if not VERSIONLATEST then
if VERSIONGLOBAL ~= VERSIONLATEST then
local update_text = "Update available!"
local notlatest_w, _ = surface.GetTextSize(update_text)
surface.SetTextColor(255, 255, 255, 30)

View file

@ -3,17 +3,3 @@ include("shared.lua")
for _, v in ipairs(file.Find("gamemodes/beatrun/gamemode/cl/*.lua", "GAME")) do
include("cl/" .. v)
end
http.Fetch("https://raw.githubusercontent.com/JonnyBro/beatrun/main/version.txt", function(body, size, headers, code)
if code == 200 then
if body == VERSIONGLOBAL then
VERSIONLATEST = true
else
VERSIONLATEST = false
end
else
print("Error while checking version:\n" .. body)
end
end, function(e)
print("Error while checking version:\n" .. e)
end)

View file

@ -1,5 +1,5 @@
VERSIONGLOBAL = "1.0.9"
VERSIONLATEST = NULL
VERSIONGLOBAL = "1.0.10"
VERSIONLATEST = ""
DeriveGamemode("sandbox")
@ -14,3 +14,13 @@ for _, v in ipairs(file.Find("gamemodes/beatrun/gamemode/sh/*.lua", "GAME", "nam
AddCSLuaFile("sh/" .. v)
include("sh/" .. v)
end
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]", "")
else
print("Error while checking version (not 200 code):\n" .. body)
end
end, function(e)
print("Error while checking version (error on fetch):\n" .. e)
end)

View file

@ -1 +1 @@
1.0.9
1.0.10