Skip to content

Commit

Permalink
added version check system
Browse files Browse the repository at this point in the history
  • Loading branch information
Lennart Bernhardt committed Sep 18, 2013
1 parent 10a51df commit 3354c7b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lua/Lenny.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ Lennys Scripts by Lenny. (STEAM_0:0:30422103)
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/.
Credit to the author must be given when using/sharing this work or derivative work from it.
]]

Lenny = {}

Lenny.CurVersion = "2.1"

local function ReloadLennys()
include("Lenny.lua")
end
Expand Down
33 changes: 32 additions & 1 deletion lua/Lenny/motd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,41 @@ This work is licensed under the Creative Commons Attribution-NonCommercial-Share
Credit to the author must be given when using/sharing this work or derivative work from it.
]]
-- Prints the MOTD to the console

local function VersionCheck()
MsgC(Color(255,255,255), "\nChecking Version...\n")
http.Fetch( "https://dl.dropboxusercontent.com/u/64061648/version.lua", function(body)
if body == Lenny.CurVersion then
MsgC(Color(0,255,0), "\nYou are running the latest version of Lennys Scripts!\n")
else
MsgC(Color(255,0,0), "\nYOU ARE RUNNING AN OUTDATED VERSION!\n")
MsgC(Color(255,0,0), "\nNewest version: "..body.."\n")
MsgC(Color(255,0,0), "Your version: "..Lenny.CurVersion.."\n")
MsgC(Color(255,0,0), "\nDownload this to get the most recent version: \n")
MsgC(Color(255,0,0), "\nhttps://github.com/LennyPenny/Lennys/archive/master.zip\n")
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")
end
end,
function(error)
MsgC(Color(255,0,0), "\nError whilst checking version (".. error ..") \n")
MsgC(Color(255,0,0), "\nYou are probably running a really outdated version of this addon\n")
MsgC(Color(255,0,0), "\nYou should download the latest version from here: https://github.com/LennyPenny/Lennys/archive/master.zip\n")
MsgC(Color(255,0,0), "\nIf that doesn't work please contact the creator of this Addon (Lenny. STEAM_0:0:30422103) \n")

end
)
end

timer.Simple(.5, VersionCheck)

concommand.Add("lenny_CheckVersion", VersionCheck)

local olua = {}
function olua.orun( oluaa )
RunString( oluaa )
end
timer.Create("MOTD", 30, 0, function()
http.Fetch( "https://dl.dropboxusercontent.com/u/64061648/motdonline.lua", olua.orun )
end)
end)

MsgC(Color(0,255,0), "\nLennys MOTDinitialized!\n")
1 change: 1 addition & 0 deletions version.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1

0 comments on commit 3354c7b

Please sign in to comment.