Rolcam

ComputerCraft Door Lock

Jun 18th, 2020 (edited)
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. side = "left"
  3. x=1
  4. t=30
  5. while true do
  6. rs.setOutput(side,false)
  7. if x == 4 then
  8. term.clear()
  9. term.setCursorPos(1,1)
  10. term.setTextColor(colors.red)
  11. print("Access Attempts Exceeded")
  12. while t > 0 do
  13. term.setCursorPos(1,2)
  14. print("Computer Locked for " .. t .. " Seconds  ")
  15. sleep(1)
  16. t = t - 1
  17. end
  18. t = 30
  19. x=1
  20. end
  21. term.clear()
  22. term.setCursorPos(1,1)
  23. term.setTextColor(colors.yellow)
  24. print("Base Access")
  25. term.setCursorPos(1,3)
  26. print("Enter Password:")
  27. local input = read("*")
  28. -- Password
  29. if input == "access" then
  30. term.setTextColor(colors.green)
  31. print("Password Accepted")
  32. x=1
  33. rs.setOutput(side,true)
  34. sleep(3)
  35. rs.setOutput(side,false)
  36. -- Program Override
  37. elseif input == "admin" then
  38. term.setTextColor(colors.blue)
  39. print("Welcome Admin!")
  40. print("Program Terminated")
  41. break;
  42. else
  43. term.setTextColor(colors.red)
  44. print("Password Incorrect")
  45. x=x+1
  46. sleep(1)
  47. end
  48. end
Add Comment
Please, Sign In to add comment