Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. username = "koda"
  3. password = "123456"
  4. attempt = 0
  5.  
  6. function attemptCheck()
  7. if attempt > 3 then
  8. term.clear()
  9. term.setCursorPos(1,1)
  10. textutils.slowPrint ("Attempt limit reached.")
  11. sleep(1)
  12. textutils.slowPrint ("Shutting down...")
  13. sleep(1)
  14. os.reboot()
  15. end
  16. end
  17.  
  18.  
  19. function login()
  20. attemptCheck()
  21. print ("Login attempt: ", attempt)
  22. write "Username: "
  23. input = read()
  24. if input == username then
  25. write "Password: "
  26. input = read("*")
  27. if input == password then
  28. textutils.slowPrint ("Welcome to your computer, ".. username ..".")
  29. sleep(2)
  30. term.clear()
  31. term.setCursorPos(1,1)
  32. else
  33. textutils.slowPrint ("The password was incorrect.")
  34. sleep(1)
  35. textutils.slowPrint ("Please attempt again.")
  36. attempt = attempt + 1
  37. sleep(1)
  38. term.clear()
  39. term.setCursorPos(1,1)
  40. login()
  41. end
  42. else
  43. textutils.slowPrint ("The username was not recognized.")
  44. sleep(1)
  45. textutils.slowPrint ("Please attempt again.")
  46. attempt = attempt + 1
  47. sleep(1)
  48. term.clear()
  49. term.setCursorPos(1,1)
  50. login()
  51. end
  52. end
  53.  
  54.  
  55. login()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement