Guest User

Untitled

a guest
Oct 11th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. local locker = true
  2. local failed = true
  3. local attempted_login = true
  4. local password_server = #27 -- change to the ID of your password server computer
  5. rednet.open("left") -- 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 to CLIENT-PC #4 : Roaming Profile Enabled")
  11. print("What would you like to do?")
  12. print("[1] Login (*)")
  13. print("[2] Shutdown")
  14. write("> ")
  15. local input = read()
  16. if input == "2" then
  17. os.shutdown()
  18. elseif input == "1" then
  19. attempted_login = true
  20. print("Please login...")
  21. write("Username: ")
  22. local username = read()
  23. write("Password: ")
  24. local password = read("*")
  25. rednet.send(password_server, username)
  26. senderId, message, distance = rednet.receive(5)
  27. if password == message then
  28. failed = false
  29. locker = false
  30. term.clear()
  31. term.setCursorPos(1,1)
  32. print("Welcome ", username)
  33. else
  34. print("Not authorised.")
  35. sleep(1)
  36. end
  37. else
  38. print("Command not recognised...")
  39. sleep(2)
  40. end
  41. end
Add Comment
Please, Sign In to add comment