Advertisement
Guest User

Untitled

a guest
May 12th, 2016
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. --os.pullEvent = os.pullEventRaw
  2. local monitor = peripheral.find("monitor")
  3. function lock()
  4. if user = nil and pass = nil then
  5. textutils.slowPrint("Hello, what would you like your username to be?")
  6. user = read()
  7. textutils.slowPrint("Hello ", user, ". What would you like your password to be?")
  8. pass = read()
  9. textutils.slowPrint("Okay, setup finished, rebooting in 2 seconds")
  10. sleep(2)
  11. os.reboot
  12. end
  13. if peripheral.find("monitor") then
  14. monitor.setTextScale(3)
  15. monitor.setBackgroundColor(colors.red)
  16. monitor.clear()
  17. monitor.setCursorPos(2,5)
  18. monitor.write("Currently Locked")
  19. end
  20. term.clear()
  21. term.setCursorPos(1,1)
  22. term.setTextColor(colors.yellow)
  23. textutils.slowPrint("MC Crafters Security System")
  24. term.setTextColor(colors.white)
  25. sleep(1)
  26. textutils.slowWrite("Username: ")
  27. user = term.setTextColor(colors.yellow)
  28. user = read()
  29. term.setTextColor(colors.white)
  30. textutils.slowWrite("Password: ")
  31. pass = term.setTextColor(colors.yellow)
  32. pass = read("*")
  33. if user == "Admin" and pass == "password" then
  34. if peripheral.find("monitor") then
  35. monitor.setTextScale(3)
  36. monitor.setBackgroundColor(colors.green)
  37. monitor.clear()
  38. monitor.setCursorPos(2,5)
  39. monitor.write("Currently Unlocked")
  40. end
  41. term.setTextColor(colors.green)
  42. term.setCursorPos(1,4)
  43. term.slowPrint("Valid Login Credentials. Welcome to the System.")
  44. sleep(2)
  45. term.clear()
  46. term.setCursorPos(1,1)
  47. term.setTextColor(colors.yellow)
  48. print(os.version())
  49. term.setCursorPos(1,2)
  50. else
  51. term.setCursorPos(1,4)
  52. term.setTextColor(colors.red)
  53. textutils.slowPrint("Invalid Login Credenials, Please Don't Try Again.")
  54. sleep(2)
  55. lock()
  56. end
  57. end
  58.  
  59. if not fs.exists("startup") then
  60. local file = fs.open("startup", "w")
  61. file.write("shell.run(\"lock\")")
  62. file.close()
  63. os.reboot()
  64. end
  65.  
  66. lock()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement