diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua b/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua index 1159285..86a204e 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua @@ -131,13 +131,24 @@ local function BeatrunHUD() surface.SetFont("DebugFixedSmall") - local vtext = VERSIONGLOBAL - local tw, _ = surface.GetTextSize(vtext) - surface.SetTextColor(255, 255, 255, 15) + local tw, _ = surface.GetTextSize("v" .. VERSIONGLOBAL) + surface.SetTextColor(255, 255, 255, 20) surface.SetTextPos(scrw - tw, 0) - surface.DrawText(vtext) + surface.DrawText("v" .. VERSIONGLOBAL) surface.SetFont("BeatrunHUD") + if file.Exists("beatrun/version.txt", "DATA") then + local latest_version = file.Read("beatrun/version.txt", "DATA") + + if latest_version ~= VERSIONGLOBAL then + local notlatest_w, _ = surface.GetTextSize("Update available!") + surface.SetTextColor(255, 255, 255, 30) + surface.SetTextPos(scrw - notlatest_w, 10) + surface.DrawText("Update available!") + surface.SetFont("BeatrunHUD") + end + end + local pl = ply:GetNW2Int("PLoss") local CT = CurTime() diff --git a/beatrun/gamemodes/beatrun/gamemode/cl_init.lua b/beatrun/gamemodes/beatrun/gamemode/cl_init.lua index 7b719c4..ac153f7 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl_init.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl_init.lua @@ -2,4 +2,18 @@ include("shared.lua") for _, v in ipairs(file.Find("gamemodes/beatrun/gamemode/cl/*.lua", "GAME")) do include("cl/" .. v) -end \ No newline at end of file +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 + file.Write("beatrun/version.txt", body) + else + print("Latest version already") + end + else + print("Error while checking version:\n" .. body) + end +end, function(e) + print("Error while checking version:\n" .. e) +end) \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/gamemode/shared.lua b/beatrun/gamemodes/beatrun/gamemode/shared.lua index 399c263..5dfbf66 100644 --- a/beatrun/gamemodes/beatrun/gamemode/shared.lua +++ b/beatrun/gamemodes/beatrun/gamemode/shared.lua @@ -1,11 +1,11 @@ -VERSIONGLOBAL = "v1.0.7" +VERSIONGLOBAL = "1.0.8" DeriveGamemode("sandbox") GM.Name = "Beatrun" -GM.Author = "who cares" -GM.Email = "whocares@noone.com" -GM.Website = "www.mirrorsedge.com xd" +GM.Author = "N/A" +GM.Email = "N/A" +GM.Website = "github.com/JonnyBro/beatrun" include("player_class/player_beatrun.lua") diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..337a6a8 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +1.0.8 \ No newline at end of file