Guest User

Untitled

a guest
Jan 20th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. while true do
  2.  
  3. term.clear()
  4.  
  5. term.setCursorPos(1, 1)
  6.  
  7. mon = peripheral.wrap("top")
  8. mon.clear()
  9.  
  10. local user
  11. term.write("Enter a username: ")
  12. user = read()
  13.  
  14. mon.setCursorPos(3, 1)
  15. mon.write("User:".. user)
  16. mon.setCursorPos(3, 2)
  17. mon.write("Time:")
  18.  
  19. local password1
  20. term.write("Enter a password: ")
  21. password1 = read("*")
  22.  
  23. redstone.setOutput( "left", true)
  24. term.clear()
  25. term.setCursorPos(1, 1)
  26. print("Closing the door in 5 seconds")
  27. sleep(5)
  28. redstone.setOutput( "left", false)
  29.  
  30. term.clear()
  31. term.setCursorPos(1, 1)
  32.  
  33. local password2 = 1
  34. print("Enter your password to open the door: ")
  35.  
  36. mon.setCursorPos(8, 2)
  37. local time = 1
  38.  
  39. while password2==1 do
  40.   time = time + 1
  41.   password2 = read("*")
  42.   mon.write(time)
  43.   sleep(1)
  44. end
  45.  
  46. while password1 ~= password2 do
  47. if password1 == password2 then
  48.   print("Correct.")
  49.   redstone.setOutput("left", true)
  50.   sleep(5)
  51.   redstone.setOutput("left", false)
  52. else
  53.   print("wrong password.")
  54.   sleep(1)
  55.   term.clear()
  56.   term.setCursorPos(1, 1)
  57.   print("Enter your password to open the door: ")
  58.   password2 = read("*")
  59. end
  60. end
  61. --above is broken
  62. end
Add Comment
Please, Sign In to add comment