Guest User

Untitled

a guest
Jan 21st, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 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.  
  18. local password1
  19. term.write("Enter a password: ")
  20. password1 = read("*")
  21.  
  22. redstone.setOutput( "left", true)
  23. term.clear()
  24. term.setCursorPos(1, 1)
  25. print("Closing the door in 5 seconds")
  26. sleep(5)
  27. redstone.setOutput( "left", false)
  28.  
  29. term.clear()
  30. term.setCursorPos(1, 1)
  31.  
  32. local password2
  33. print("Enter your password to open the door: ")
  34.  
  35. mon.setCursorPos(8, 2)
  36.  
  37. password2 = read("*")
  38.  
  39. while password1 ~= password2 do
  40.   print("wrong password.")
  41.   sleep(1)
  42.   term.clear()
  43.   term.setCursorPos(1, 1)
  44.   print("Enter your password to open the door: ")
  45.   password2 = read("*")
  46. end
  47.  
  48. if password1 == password2 then
  49.   print("Correct.")
  50.   redstone.setOutput("left", true)
  51.   sleep(5)
  52.   redstone.setOutput("left", false)
  53. end
  54.  
  55. end
Add Comment
Please, Sign In to add comment