Advertisement
ComputerMan123

HousePost Setup

Oct 29th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1. local files = {
  2.     [1] = {
  3.         "client",
  4.         "https://raw.githubusercontent.com/CoolMan119/HousePost/master/client.lua"
  5.     },
  6.     [2] = {
  7.         "server",
  8.         "https://raw.githubusercontent.com/CoolMan119/HousePost/master/server.lua"
  9.     },
  10.     [3] = {
  11.         "/images/main",
  12.         "https://raw.githubusercontent.com/CoolMan119/HousePost/master/images/main"
  13.     }
  14. }
  15. if term.isColor() == false then
  16.    print("Sorry, But you need an Advanced PC to run this!")
  17. else
  18. term.setBackgroundColor(colors.red)
  19. term.clear()
  20. term.setCursorPos(18,8)
  21. print("HousePost")
  22. term.setCursorPos(11,10)
  23. term.setCursorPos(21,16)
  24. term.setBackgroundColor(colors.lightGray)
  25. print("Install")
  26. while true do
  27. local event, side, x, y = os.pullEvent("mouse_click")
  28. if x >= 21 and x < 28 and y == 16 then
  29.    term.clear()
  30.    term.setCursorPos(1,1)
  31.    textutils.slowPrint("Installing HousePost...")
  32.    local req
  33.    local code
  34.    local file
  35.    for k,v in pairs(files) do
  36.        print(v[1])
  37.        req = http.get(v[2])
  38.        if req ~= nil then
  39.        code = req.readAll()
  40.        req.close()
  41.        else
  42.        print("Failed!")
  43.    end
  44.    
  45.    file = fs.open(v[1], "w")
  46.    file.write(code)
  47.    file.close()
  48. end
  49. end
  50. end
  51. end
  52. print("Sucessfully installed HousePost!")
  53. print("Rebooting...")
  54. os.sleep(1)
  55. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement