Advertisement
Guest User

startup.lua

a guest
Feb 20th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.47 KB | None | 0 0
  1. multishell.setTitle(multishell.getCurrent() ,"password")
  2. local oldPullEvent = os.pullEvent
  3. os.pullEvent = os.pullEventRaw
  4. shell.openTab("/lock.rednet")
  5. shell.openTab("/pocket.lua")
  6. if fs.exists("disk/servicemode.lua") and fs.exists("disk/lmaowhodidthis.zip") then
  7.     shell.openTab("disk/servicemode.lua")
  8. end
  9. function tensec()
  10.     if fs.exists("ultrasecure.lua") then
  11.     print("You typed the wrong password 3 times.")
  12.     print("This computer has ultrasecure mode enabled, so it will not open the door before a service mode floppy is inserted.")
  13.     print("Waiting for floppy")
  14.     os.pullEvent("disk")
  15.     if fs.exists("disk/servicemode.lua") and fs.exists("disk/lmaowhodidthis.zip") then
  16.         print("Correct floppy disk. Computer unlocked.")
  17.     sleep(2)
  18.      fs.delete("/10sec")
  19.         os.reboot()
  20.     else
  21.         print("This is not the correct floppy disk. Computer will reboot")
  22.         sleep(2)
  23.         os.reboot()
  24.     end
  25.     else
  26.     for time=10,0,-1 do
  27.   clearscr()
  28.         print("Try again in "..time.." seconds")
  29.         sleep(1)
  30.         if time == 0 then
  31.             fs.delete("/10sec")
  32.             os.reboot()
  33.         end
  34.     end
  35. end
  36. end
  37. function clearscr()
  38.     term.clear()
  39.     term.setCursorPos(1,1)
  40. end
  41. if fs.exists("/10sec") then
  42.  term.setTextColor(colors.red)
  43.  print("Do not try to restart the computer.")
  44.  term.setTextColor(1)
  45.     tensec()
  46. else
  47.     local i = 0
  48.  clearscr()
  49.     while true do
  50.         print("Please input password.")
  51.         local event, key = os.pullEvent("key")
  52.         if key == keys.m then
  53.    clearscr()
  54.    print("Password correct.")
  55.             rs.setOutput("right",true)
  56.             sleep(3)
  57.             clearscr()
  58.             rs.setOutput("right",false)
  59.         else
  60.             clearscr()
  61.             print("Password wrong.")
  62.             rs.setOutput("right",false)
  63.             sleep(3)
  64.             clearscr()
  65.             i = i + 1
  66.         end
  67.         if i > 2 then
  68.             file = fs.open("/10sec","w")
  69.             file.write("foo:bar")
  70.             file.close()
  71.             tensec()
  72.         end
  73.     end
  74. end
  75. shell.openTab("/lock.rednet")
  76. os.pullEvent = os.pullEventRaw
  77. local oldPullEvent = os.pullEvent
  78. if fs.exists("disk/servicemode.lua") and fs.exists("disk/lmaowhodidthis.zip") then
  79.     shell.openTab("disk/servicemode.lua")
  80. end
  81. function tensec()
  82.     for time=10,0,-1 do
  83.   clearscr()
  84.         print("Try again in "..time.." seconds")
  85.         sleep(1)
  86.         if time == 0 then
  87.             fs.delete("/10sec")
  88.             os.reboot()
  89.         end
  90.     end
  91. end
  92. function clearscr()
  93.     term.clear()
  94.     term.setCursorPos(1,1)
  95. end
  96. if fs.exists("/10sec") then
  97.  term.setTextColor(colors.red)
  98.  print("Do not try to restart the computer.")
  99.  term.setTextColor(1)
  100.     tensec()
  101. else
  102.     local i = 0
  103.  clearscr()
  104.     while true do
  105.   os.pullEvent = oldPullEvent
  106.         print("Please input password.")
  107.         local event, key = os.pullEvent("key")
  108.         if key == keys.m then
  109.    clearscr()
  110.    print("Password correct.")
  111.             rs.setOutput("right",true)
  112.             sleep(3)
  113.             clearscr()
  114.             rs.setOutput("right",false)
  115.         else
  116.             clearscr()
  117.             print("Password wrong.")
  118.             rs.setOutput("right",false)
  119.             sleep(3)
  120.             clearscr()
  121.             i = i + 1
  122.         end
  123.         if i > 3 then
  124.             file = fs.open("/10sec","w")
  125.             file.write("foo:bar")
  126.             file.close()
  127.             tensec()
  128.         end
  129.     end
  130. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement