Jetro

ShopInstaller.lua

Nov 20th, 2021 (edited)
716
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. --[[
  2.  
  3.     Name = Shop/ShopInstaller.lua
  4.     Version = 1.1
  5.     Date = 2/12/2021
  6.     Time = 15:40
  7.     Author = Jetro
  8.  
  9. ]]
  10.  
  11. -- Variables
  12.  
  13. local Serverfiles = {
  14.     {"Shop/Server.lua","fy0T5iPx"},
  15.     {"Shop/ShopInstaller.lua","FP0yRNS7"},
  16.     {"Base64.api","zAKYhveJ"},
  17. }
  18.  
  19. local Clientfiles = {
  20.     {"Base64.api","zAKYhveJ"},
  21.     {"screen.api","uSzxUdLg"},
  22.     {"Shop/Client.lua","xZe3hbqP"},
  23.     {"Shop/ShopInstaller.lua","FP0yRNS7"},
  24. }
  25.  
  26. local InvFile = "Shop/Inventory.cfg"
  27. local WaitTime = 10
  28. local Inv = {
  29.     a = {
  30.         0,
  31.         0,
  32.     },
  33. }
  34. -- Main
  35.  
  36. shell.run("clear")
  37. print("What do you want to install?")
  38. print("[1] Server")
  39. print("[2] Client")
  40.  
  41. parallel.waitForAny(
  42.     function()
  43.         input = read()
  44.     end,
  45.  
  46.     function()
  47.         repeat
  48.             term.setCursorPos(30,1)
  49.             print("("..WaitTime..")   ")
  50.             WaitTime = WaitTime - 1
  51.             term.setCursorPos(1,4)
  52.             sleep(1)
  53.         until WaitTime == 0
  54.         input = "1"
  55.     end
  56. )
  57.  
  58. if input == nil then
  59.     input = 1
  60. end
  61.  
  62. if input == "1" or input == "Server" then
  63.     for i = 1, #Serverfiles do
  64.         if fs.exists(Serverfiles[i][1]) then
  65.             fs.delete(Serverfiles[i][1])
  66.         end
  67.         shell.run("pastebin get "..Serverfiles[i][2].." "..Serverfiles[i][1])
  68.     end
  69.     if fs.exists(InvFile) == false then
  70.         myInv = fs.open(InvFile,"w")
  71.         myInv.write("-- FORMAT { amount, price }\n")
  72.         myInv.write(textutils.serialise(Inv))
  73.         myInv.close()
  74.     end
  75. elseif input == "2" or input == "Client" then
  76.     for i = 1, #Clientfiles do
  77.         if fs.exists(Clientfiles[i][1]) then
  78.             fs.delete(Clientfiles[i][1])
  79.         end
  80.         shell.run("pastebin get "..Clientfiles[i][2].." "..Clientfiles[i][1])
  81.     end
  82. end
  83.  
  84. os.reboot()
Add Comment
Please, Sign In to add comment