KrabPlotva

Password

Mar 21st, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. -- Загружаем библиотеки
  2. local term = require("term")
  3. local sides = require("sides")
  4. local note = require("note")
  5. local component = require("component")
  6. -- Загружаем локалки
  7. local rs = component.redstone
  8. local password = "123", try
  9. local exit = "AdminKey", try
  10. term.clear()
  11. -- Запускаем вечный цикл проги
  12.     while true do
  13. -- Прописываем сообщения
  14.     io.write("Введи пароль: ")
  15.     err, try = pcall(io.read)
  16. -- Если пользователь попытался выйти с программы (ctrl+alt+C)
  17.         if not err then
  18.             print("Нее! Не прокатит!")
  19. -- Пошли проверки паролей
  20.         elseif try == password then
  21.             print("Ок! Иди! У тебя 3 секунды.")
  22.             rs.setOutput(sides.east, 15)
  23.             note.play(83, 0.3)
  24.             note.play(90, 0.2)
  25.             os.sleep(2.5)
  26.             print("Усё. Время вышло.")
  27.             rs.setOutput(sides.east, 0)
  28.         elseif try == exit then
  29.             note.play(90, 0.5)
  30.             print("Ключ прокатил. Выхожу из проги...")
  31.             os.sleep(2.5)
  32.             term.clear()
  33.             break
  34.         else
  35.             print("Не прошло! Попробуй еще разок, другой.")
  36.             note.play(70, 0.2)
  37.         end
  38.     end
Add Comment
Please, Sign In to add comment