• Update checker?
    5 replies, posted
Is there a way to make a update checker? I've seen somewhere in a addon one, it used net library(which I dont understand yet :x) I dont remember which it was, nor did I understand the check function..?
Yeah. Most people http.Fetch a version.txt file in their github repo and compare it to a local version.txt file.
My addons have an update checker.. I also released the .bat file which updates the version.txt Feel free to use it them: [url]https://bitbucket.org/Acecool/acecooldev_base/src/[/url] [url]https://bitbucket.org/Acecool/acecooldev_networking/src/[/url] [url]https://bitbucket.org/Acecool/acecooldev_networking/src/master/lua/acecooldev_networking/server/sv_check_version.lua?at=master[/url] or [url]https://bitbucket.org/Acecool/acecooldev_base/src/master/gamemode/addons/_version_control/sv_check_version.lua?at=master[/url] Version Control System.. You may need to update some of the paths but this'll help manage the version.txt... [url]https://bitbucket.org/Acecool/version-updater-tool/src[/url]
I experiemented a bit with http.fetch, and found a easier way, which is just 4-5 lines of code ;-; #CaseClosed
For everybody who wants the small code: [CODE] AddCSLuaFile() include("cl_config.lua") http.Fetch(settings.verurl, function(body, len, headers, code) -- replace settings.verurl with your file url version = {} version.l = "0.0.0" -- set your local version version.o = body -- sets official version to the file content end) [/CODE] You can do the checkers on your own, I got like this: [CODE] if version.l != version.o then -- Code here end [/CODE]
Sorry, you need to Log In to post a reply to this thread.