Tomodachi94

ComputerCraft Computer Lock

Jun 30th, 2020 (edited)
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. --original design: https://pastebin.com/kx1j3yYg
  2. --I simply adapted this code to create a lock for your ComputerCraft computer. I DO NOT TAKE CREDIT FOR THE ORIGINAL CODE, ONLY
  3. --THE ADAPTATIONS.
  4. --This is under no guarantee to work. I am not liable for the loss of your files on your computer.
  5.  
  6. local oldPull = os.pullEvent; -- Prevents CTRL-T
  7. os.pullEvent = os.pullEventRaw; -- Prevents CTRL-T
  8.  
  9. term.clear()
  10. term.setCursorPos(1,1)
  11. password = "1234" --Put your password here
  12. write("Password: ")
  13. input = read("*")
  14. if input == password then
  15.                 print("Access granted")
  16.                 break
  17.         end
  18. else
  19.         print("Access denied")
  20.         sleep(3)
  21.         os.reboot()
  22. end
  23.  
  24. os.pullEvent = oldPull;
Advertisement
Add Comment
Please, Sign In to add comment