Advertisement
Vorobey59

[OpenComputers] Locl.lua(кодовый замок)

Apr 2nd, 2016
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. local term = require("term")
  2. local component = require("component")
  3. local sides = require("sides")
  4. local gpu = component.gpu
  5. local rs = component.redstone
  6.  
  7. if not component.isAvailable("redstone") then
  8. term.clear()
  9. print("Для работы данной программы требуется 'Плата на красном камне'!")
  10. os.sleep(5)
  11. else
  12. term.clear()
  13. local rs = component.redstone
  14. print("'Плата на красном камне' - обнаружена. Программа запускается!")
  15. os.sleep(5)
  16. term.clear()
  17. end
  18.  
  19. local password = {
  20. user = "9182",
  21. admin = "exit",
  22. }
  23.  
  24. local try
  25.  
  26. gpu.setResolution(80,25)
  27. rs.setOutput(sides.north, 0)
  28.  
  29. while true do
  30. io.write("\nВведите пароль: ")
  31. err, try = pcall(io.read)
  32. if not err then
  33. print("Для заверщения программы введите Админ пароль!")
  34. elseif try == "cls" then
  35. term.clear()
  36. elseif try == password.user then
  37. io.write("Доступ разрешён! У Вас 5 секунд, что бы войти :3")
  38. rs.setOutput(sides.north, 15)
  39. os.sleep(5)
  40. rs.setOutput(sides.north, 0)
  41. elseif try == password.admin then
  42. io.write("Вы ввели Админ пароль! Программа выключается")
  43. os.sleep(3)
  44. break
  45. else
  46. io.write("\nВ доступе отказано! Пароль не верный!")
  47. rs.setOutput(sides.north, 0)
  48. end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement