Advertisement
LDDestroier

SimSoft 2.1.x Install GPS MInimap

Mar 4th, 2016
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.01 KB | None | 0 0
  1. local pF = {
  2.     name = "Map",               --string
  3.     folder = "GPSMinimap",      --string
  4.     colorCode = 1,              --number
  5.     liveSystem = "",            --string
  6.     files = {                   --table
  7.         ["Map"] = "x9ajKSc0",   --[string] = string
  8.     }
  9. }
  10.  
  11. local getFromPastebin = function(code,path)
  12.     if not type(code) == "string" then
  13.         error("Expected pastebin code")
  14.     elseif not type(path) == "string" then
  15.         error("Expected file path")
  16.     end
  17.     local prog = http.get("http://pastebin.com/raw/"..code)
  18.     if not code then
  19.         return false, "could not connect"
  20.     end
  21.     prog = prog.readAll()
  22.     if fs.exists(fs.getName(path)) and not fs.isDir(fs.getName(path)) then
  23.         return false, "file exists in that path"
  24.     end
  25.     if not fs.exists(fs.getDir(path)) then
  26.         fs.makeDir(fs.getDir(path))
  27.     end
  28.     local file = fs.open(path,"w")
  29.     file.write(prog)
  30.     file.close()
  31.     return true, fs.getSize(path)
  32. end
  33.  
  34. --App Installer - by SimlorLP
  35. function appInstaller(name,farbe,ver,loesch,LiveJaNein,LivePfad)
  36.     term.setBackgroundColor(128)
  37.     term.setTextColor(1)
  38.     term.clear()
  39.     print("Starting installation...")
  40.     --Absicherung
  41.     local file = fs.open("SimSoft/Daten/SappS/A","r")
  42.     local fileData = {}
  43.     local line = file.readLine()
  44.     repeat
  45.         table.insert(fileData,line)
  46.         line = file.readLine()
  47.     until line == nil
  48.     file.close()
  49.     anz = tonumber(fileData[1])
  50.     if anz >= 15 then
  51.         print("Too many apps.")
  52.         sleep(0.4)
  53.         return
  54.     else
  55.         anz = (anz+1)
  56.         local file = fs.open("SimSoft/Daten/SappS/A","w")
  57.         file.write(anz)
  58.         file.close()
  59.         local file = fs.open("SimSoft/Daten/SappS/"..anz,"w")
  60.         file.writeLine(name)
  61.         file.writeLine(anz)
  62.         file.writeLine(farbe.."\n")
  63.         file.writeLine(ver)
  64.         file.writeLine(loesch)
  65.         if LiveJaNein ~= "" then
  66.             file.writeLine("t")
  67.             file.writeLine(LiveJaNein)
  68.         else
  69.             file.writeLine("f\n")
  70.         end
  71.         file.close()
  72.     end
  73. end
  74. for k,v in pairs(pF.files) do
  75.     getFromPastebin(v,fs.combine(fs.combine("SimSoft/SappS",pF.folder),k))
  76. end
  77. appInstaller(string.sub(pF.name,1,6),tostring(pF.colorCode)..".0",fs.combine(pF.folder,pF.name),pF.folder,pF.liveSystem)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement