Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Configuration
- local password = "secretPassword" -- Set your secret password here
- local doorSide = "left" -- Set the side where the door is located (left, right, front, back, top, bottom)
- -- Decoration function
- function decorate()
- print("****************************************")
- print("* *")
- print("* Welcome to the Security System *")
- print("* *")
- print("****************************************")
- end
- -- Main program
- while true do
- decorate()
- print("Enter password to open the door:")
- local enteredPassword = read("*") -- Password will not be shown when typing
- if enteredPassword == password then
- print("Password correct. Opening door...")
- redstone.setOutput(doorSide, true) -- Opens the door
- sleep(5) -- Wait for 5 seconds
- redstone.setOutput(doorSide, false) -- Closes the door
- print("Door closed.")
- else
- print("Incorrect password.")
- end
- print("Waiting for the next attempt...")
- sleep(3) -- Wait for 3 seconds before the next attempt
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement