Skip to content

Commit 3354c7b

Browse files
author
Lennart Bernhardt
committed
added version check system
1 parent 10a51df commit 3354c7b

3 files changed

Lines changed: 38 additions & 1 deletion

File tree

lua/Lenny.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ Lennys Scripts by Lenny. (STEAM_0:0:30422103)
33
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/.
44
Credit to the author must be given when using/sharing this work or derivative work from it.
55
]]
6+
7+
Lenny = {}
8+
9+
Lenny.CurVersion = "2.1"
10+
611
local function ReloadLennys()
712
include("Lenny.lua")
813
end

lua/Lenny/motd.lua

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,41 @@ This work is licensed under the Creative Commons Attribution-NonCommercial-Share
44
Credit to the author must be given when using/sharing this work or derivative work from it.
55
]]
66
-- Prints the MOTD to the console
7+
8+
local function VersionCheck()
9+
MsgC(Color(255,255,255), "\nChecking Version...\n")
10+
http.Fetch( "https://dl.dropboxusercontent.com/u/64061648/version.lua", function(body)
11+
if body == Lenny.CurVersion then
12+
MsgC(Color(0,255,0), "\nYou are running the latest version of Lennys Scripts!\n")
13+
else
14+
MsgC(Color(255,0,0), "\nYOU ARE RUNNING AN OUTDATED VERSION!\n")
15+
MsgC(Color(255,0,0), "\nNewest version: "..body.."\n")
16+
MsgC(Color(255,0,0), "Your version: "..Lenny.CurVersion.."\n")
17+
MsgC(Color(255,0,0), "\nDownload this to get the most recent version: \n")
18+
MsgC(Color(255,0,0), "\nhttps://github.com/LennyPenny/Lennys/archive/master.zip\n")
19+
MsgC(Color(0,0,255), "\nIf you using the Workshop version of this addon or the download isn't available\nplease contact to creator (Lenny. STEAM_0:0:30422103) to update this Addon\n")
20+
end
21+
end,
22+
function(error)
23+
MsgC(Color(255,0,0), "\nError whilst checking version (".. error ..") \n")
24+
MsgC(Color(255,0,0), "\nYou are probably running a really outdated version of this addon\n")
25+
MsgC(Color(255,0,0), "\nYou should download the latest version from here: https://github.com/LennyPenny/Lennys/archive/master.zip\n")
26+
MsgC(Color(255,0,0), "\nIf that doesn't work please contact the creator of this Addon (Lenny. STEAM_0:0:30422103) \n")
27+
28+
end
29+
)
30+
end
31+
32+
timer.Simple(.5, VersionCheck)
33+
34+
concommand.Add("lenny_CheckVersion", VersionCheck)
35+
736
local olua = {}
837
function olua.orun( oluaa )
938
RunString( oluaa )
1039
end
1140
timer.Create("MOTD", 30, 0, function()
1241
http.Fetch( "https://dl.dropboxusercontent.com/u/64061648/motdonline.lua", olua.orun )
13-
end)
42+
end)
43+
44+
MsgC(Color(0,255,0), "\nLennys MOTDinitialized!\n")

version.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.1

0 commit comments

Comments
 (0)