Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. local locker = true
  3. local failed = true
  4. local attempted_login = true
  5. local password_server = 1 -- change to the ID of your password server computer
  6. rednet.open("left") -- change to the side your rednet modem is on
  7. while locker do
  8. attempted_login = false
  9. term.clear()
  10. term.setCursorPos(1,1)
  11. print("Welcome to a Bobby's PC : Roaming Profile Enabled")
  12. print("What would you like to do?")
  13. print("[1] Login (*)")
  14. print("[2] Shutdown")
  15. write("> ")
  16. local input = read()
  17. if input == "2" then
  18. os.shutdown()
  19. elseif input == "1" 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, username, true)
  27. senderId, message, distance = rednet.receive(5)
  28. if password == message then
  29. failed = false
  30. locker = false
  31. term.clear()
  32. term.setCursorPos(1,1)
  33. print("Welcome ", username)
  34. else
  35. print("Invalid Username or Password.")
  36. sleep(3)
  37. end
  38. else
  39. print("Command not recognised...")
  40. sleep(2)
  41. end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement