mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-27 20:43:02 +05:00
Change the way version is checked
This commit is contained in:
parent
4e04a3cd75
commit
59a1a03960
3 changed files with 12 additions and 19 deletions
|
@ -138,17 +138,13 @@ local function BeatrunHUD()
|
||||||
surface.DrawText(version_text)
|
surface.DrawText(version_text)
|
||||||
surface.SetFont("BeatrunHUD")
|
surface.SetFont("BeatrunHUD")
|
||||||
|
|
||||||
if file.Exists("beatrun/version.txt", "DATA") then
|
if not VERSIONLATEST then
|
||||||
local latest_version = file.Read("beatrun/version.txt", "DATA")
|
local update_text = "Update available!"
|
||||||
|
local notlatest_w, _ = surface.GetTextSize(update_text)
|
||||||
if latest_version ~= VERSIONGLOBAL then
|
surface.SetTextColor(255, 255, 255, 30)
|
||||||
local update_text = "Update available!"
|
surface.SetTextPos(scrw - notlatest_w, 10)
|
||||||
local notlatest_w, _ = surface.GetTextSize(update_text)
|
surface.DrawText(update_text)
|
||||||
surface.SetTextColor(255, 255, 255, 30)
|
surface.SetFont("BeatrunHUD")
|
||||||
surface.SetTextPos(scrw - notlatest_w, 10)
|
|
||||||
surface.DrawText(update_text)
|
|
||||||
surface.SetFont("BeatrunHUD")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local pl = ply:GetNW2Int("PLoss")
|
local pl = ply:GetNW2Int("PLoss")
|
||||||
|
|
|
@ -6,14 +6,10 @@ end
|
||||||
|
|
||||||
http.Fetch("https://raw.githubusercontent.com/JonnyBro/beatrun/main/version.txt", function(body, size, headers, code)
|
http.Fetch("https://raw.githubusercontent.com/JonnyBro/beatrun/main/version.txt", function(body, size, headers, code)
|
||||||
if code == 200 then
|
if code == 200 then
|
||||||
if not file.Exists("beatrun/version.txt", "DATA") then
|
if body == VERSIONGLOBAL then
|
||||||
file.Write("beatrun/version.txt", body)
|
VERSIONLATEST = true
|
||||||
end
|
|
||||||
|
|
||||||
if body ~= VERSIONGLOBAL then
|
|
||||||
file.Write("beatrun/version.txt", body)
|
|
||||||
else
|
else
|
||||||
print("Latest version already")
|
VERSIONLATEST = false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print("Error while checking version:\n" .. body)
|
print("Error while checking version:\n" .. body)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
VERSIONGLOBAL = "1.0.8"
|
VERSIONGLOBAL = "1.0.9"
|
||||||
|
VERSIONLATEST = NULL
|
||||||
|
|
||||||
DeriveGamemode("sandbox")
|
DeriveGamemode("sandbox")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue