Advertisement
lmnd

CC password

Apr 4th, 2020
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. maxAttempts = 5
  2. secret = "t"
  3. side = "bottom"
  4.  
  5. function clearScreen()
  6.     term.clear()
  7.     term.setCursorPos(1,1)
  8.     term.setCursorBlink(true)
  9. end
  10.  
  11. while true do
  12.     clearScreen()
  13.     for i = 1, maxAttempts do
  14.         print("Enter passcode:")
  15.         input = read()
  16.         if input == secret then
  17.             print("Welcome!")
  18.             redstone.setOutput(side,  true)
  19.             sleep(2)
  20.             redstone.setOutput(side, false)
  21.             break
  22.         else
  23.             print("Wrong code")
  24.             sleep(1)
  25.             clearScreen()
  26.             if i == maxAttempts then
  27.                 print("Login failed. Locking...")
  28.                 sleep(30)
  29.             end
  30.         end
  31.     end
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement