Advertisement
Guest User

Untitled

a guest
Mar 17th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. local locker = true
  2. local failed = true
  3. local attempted_login = true
  4. local password_server = 0 -- change to the ID of your password server computer
  5. rednet.open("back") -- change to the side your rednet modem is on
  6. while locker do
  7. attempted_login = false
  8. term.clear()
  9. term.setCursorPos(1,1)
  10. print("Welcome Roaming Profile Enabled")
  11. print("What would you like to do?")
  12. print("[1] Login (*)")
  13. print("[2] Open door")
  14. print("[3] Shutdown")
  15. write("> ")
  16. local input = read()
  17. if input == "3" then
  18. os.shutdown()
  19. elseif input == "1" or input == "2" then
  20. attempted_login = true
  21. print("Please login...")
  22. write("Username: ")
  23. local username = read()
  24. write("Password: ")
  25. local password = read("*")
  26. rednet.send(password_server, password , true)
  27. senderId, message, distance = rednet.receive(5)
  28. if username == message then
  29. failed = false
  30. locker = false
  31. term.clear()
  32. term.setCursorPos(1,1)
  33. print("Welcome ", username)
  34. if input == "2" then
  35. redstone.setOutput("right","true")
  36. sleep(4)
  37. redstone.setOutput("right","false")
  38. locker = true
  39. end
  40.  
  41.  
  42.  
  43. else
  44. print("Invalid Username or Password.")
  45. sleep(3)
  46. end
  47. else
  48. print("Command not recognised...")
  49. sleep(2)
  50. end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement