Advertisement
subzero22

os lock

Sep 8th, 2014
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. local fileName = "OS/.password"
  2. local line
  3.  
  4. if fs.exists(fileName) then
  5. local hRead = fs.open(fileName, "r")
  6. line = hRead.readLine()
  7. hRead.close()
  8. else
  9. line = "temppass"
  10. end
  11.  
  12. local function clear()
  13. term.clear()
  14. term.setCursorPos(1,1)
  15. end
  16.  
  17. os.pullEvent = os.pullEventRaw
  18. local tries = 3
  19. while tries > 0 do
  20. clear()
  21. textutils.slowPrint("Please enter password:")
  22. print("")
  23. write("> ")
  24. local input = read("*")
  25. if input == line then
  26. textutils.slowPrint("Password Accepted.")
  27. textutils.slowPrint("Now Logging In.")
  28. sleep(1)
  29. clear()
  30. shell.run("OS/.computer")
  31. else
  32. textutils.slowPrint("Password Rejected. Access Denied!!!")
  33. tries = tries - 1
  34. print(tries.." tries remaining.")
  35. sleep(1)
  36. end
  37. end
  38.  
  39. local sec = 10
  40. while sec ~= 0 do
  41. clear()
  42. print("Please try again in "..sec.." seconds.")
  43. sec = sec - 1
  44. sleep(1)
  45. end
  46. os.shutdown()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement