Guest User

reinstall

a guest
Feb 2nd, 2019
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.78 KB | None | 0 0
  1.  
  2. if not fs.exists("ondOS") then
  3.   fs.makeDir("ondOS")
  4.   fs.makeDir("ondOS/Users")
  5.   fs.makeDir("ondOS/Lua")
  6. end
  7.  
  8. if not fs.exists("ondOS/Lua/lang") then
  9.   shell.run("pastebin get qVbWnL4N ondOS/Lua/lang")
  10. end
  11.  
  12. shell.run("ondOS/Lua/lang")
  13. shell.run("clear")
  14.  
  15. local l = lang
  16.  
  17. local function newSession(title, subtitle)
  18.   term.setBackgroundColor(colors.blue)
  19.   paintutils.drawFilledBox(1, 1, 51, 19)
  20.   term.setBackgroundColor(colors.cyan)
  21.   paintutils.drawFilledBox(1, 1, 51, 3)
  22.   term.setTextColor(colors.white)
  23.   local pos = #title / 3
  24.   term.setCursorPos(pos, 2)
  25.   write(title)
  26.   term.setCursorPos(1, 4)
  27.   term.setBackgroundColor(colors.blue)
  28.   print(subtitle)
  29.   return true
  30. end
  31.  
  32. newSession(l.setup1_title, l.setup1_subtitle)
  33. redo = true
  34.  
  35. local function iGetCode()
  36.   term.setCursorPos(1, 8)
  37.   print(l.setup1_info)
  38.   write(l.setup1_code .. ":                 ")
  39.   term.setTextColor(colors.yellow)
  40.   term.setCursorPos(7, 9)
  41.   input = read()
  42.  
  43.   if input ~= "cancel" then
  44.     num = math.random(100, 999)
  45.     term.setCursorPos(10, 10)
  46.     term.setTextColor(colors.yellow)
  47.     write("Verifying..                ")
  48.     if input == "" or string.find(input, " ") then
  49.       sleep(.3)
  50.       term.setCursorPos(10, 10)
  51.       term.setTextColor(colors.red)
  52.       write(l.setup1_novar .. "           ")
  53.       redo = true
  54.       sleep(2)
  55.       term.setTextColor(colors.white)
  56.       iGetCode()
  57.       return
  58.     end
  59.     term.setCursorPos(1, 15)
  60.     term.setTextColor(colors.blue)
  61.     shell.run("pastebin get " .. input .. " testlang" .. num)
  62.     local file = fs.open("testlang" .. num, "r")
  63.     local content = file.readAll()
  64.     if not string.find(content, "lang") then
  65.       term.setCursorPos(10, 10)
  66.       term.setTextColor(colors.orange)
  67.       write(l.setup1_nolang .. "      ")
  68.       term.setTextColor(colors.white)
  69.       sleep(.5)
  70.       redo = true
  71.     else
  72.       term.setCursorPos(10, 10)
  73.       term.setTextColor(colors.green)
  74.       write(l.setup1_set .. "           ")
  75.       if fs.exists("ondOS/Lua/lang") then
  76.         fs.delete("ondOS/Lua/lang")
  77.       end
  78.       shell.run("testlang" .. num)
  79.       l = lang
  80.       shell.run("copy testlang" .. num .. " ondOS/Lua/lang")
  81.       term.setTextColor(colors.white)
  82.       sleep(3)
  83.       redo = false
  84.     end
  85.   elseif input == "cancel" then
  86.     redo = false
  87.   end
  88.   if redo == true then
  89.     redo = false
  90.     iGetCode()
  91.     return
  92.   end
  93. end
  94.  
  95. iGetCode()
  96.  
  97. newSession(l.setup2_title, l.setup2_subtitle)
  98. term.setTextColor(colors.yellow)
  99. term.setCursorPos(12, 7)
  100. write(l.setup2_name)
  101. term.setTextColor(colors.white)
  102. term.setCursorPos(4, 8)
  103. username = read()
  104. term.setTextColor(colors.yellow)
  105. term.setCursorPos(12, 9)
  106. write(l.setup2_password)
  107. term.setTextColor(colors.white)
  108. term.setCursorPos(4, 10)
  109. password = read()
Add Comment
Please, Sign In to add comment