gaga2023

base os

Nov 26th, 2023 (edited)
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. -- Define the password
  2. local password = "1234"
  3.  
  4. while true do
  5. term.clear()
  6. term.setCursorPos(1,1)
  7. print("Enter password:")
  8.  
  9. -- Read the input from the user. The typed password will be hidden.
  10. local input = read("*")
  11.  
  12. -- Check if the entered password is correct
  13. if input == password then
  14. -- If the password is correct, emit a redstone signal
  15. redstone.setOutput("back", true)
  16. print("Access granted.")
  17. os.sleep(2) -- Keep the door open for 2 seconds
  18.  
  19. -- Turn off the redstone signal
  20. redstone.setOutput("back", false)
  21. else
  22. -- If the password is incorrect, display an error message
  23. print("Access denied.")
  24. os.sleep(2)
  25. end
  26. end
  27.  
Advertisement
Add Comment
Please, Sign In to add comment