Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- do--Minified XT downloader
- local inert=function()end;
- local cprint=print;
- local aprint=print;
- local cerr=printError;
- local cread=read;
- local xtpath="/xt";
- local autoupdate=true;
- local a=false;local b=false;local function c()if http then cprint("Checking for updates...")local d=http.get("http://www.pastebin.com/raw.php?i=BHpUQ8Hn")if d then a=tonumber(d.readLine())b=d.readLine()d.close()if not a or not b then cerr("Update paste corrupted")a=false;b=false end else cerr("Cant check for updates")end else cerr("Cant check for updates, http disabled")end end;local e=false;local f=false;local g=false;local h=false;local function i()if fs.isDir(xtpath)then cprint("\""..xtpath.."\" is a directory, not XT api")e=false;f=true elseif fs.exists(xtpath)then local j=fs.open(xtpath,"r")local k=j.readLine()j.close()if k:sub(1,6)=="--XT V"and k:sub(10)==" by negamartin"and tonumber(k:sub(7,9))then e=tonumber(k:sub(7,9))cprint("\""..xtpath.."\" is XT api V"..e)else e=false;f=true;cprint("\""..xtpath.."\" is a non-XT file")end else cprint("\""..xtpath.."\" does not exist")e=false end;if xt then g=xt.version;if type(g)=="number"then cprint("XT V"..g.." is already loaded")else g=false end else g=false end;if e then if g then h=math.max(e,g)else h=e end else h=g end end;local function l()if a and b then if http then cprint("Downloading XT V"..a.."...")local m=http.get("http://www.pastebin.com/raw.php?i="..b)if m then local j=fs.open(xtpath,"w")j.write(m.readAll())j.close()m.close()e=a;return true else cerr("Cant download XT")end else cerr("Cant download XT, http disabled")end end;return false end;i()if autoupdate or not h then c()if a then if h then if h<a then local n=true;if f then aprint("A non-XT file has been found in \""..xtpath.."\"")aprint("Overwrite it? (\"yes\" or \"no\")")if cread()=="yes"then fs.delete(xtpath)else aprint("Remove the non-XT file if you wish to update")n=false end end;if n then if l()then cprint("Updated XT to V"..a)else cprint("Couldn't download XT, using offline version")end end else cprint("XT up to date")end else if f then aprint("A non-XT file has been found in \""..xtpath.."\"")aprint("Overwrite it? (\"yes\" or \"no\")")if cread()=="yes"then fs.delete(xtpath)else aprint("Move the non-XT file and try again")error()end end;if l()then cprint("XT V"..a.." downloaded")else cerr("Couldn't download xt")error()end end else if h then cprint("Couldn't update, using offline version")else cerr("Couldn't download xt, and no offline version")error()end end end;if g then if e and e>g then dofile(xtpath)end else dofile(xtpath)end
- end
Add Comment
Please, Sign In to add comment