Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Перекодил gagaf
- --Источник https://oc.cil.li/topic/1008-opensecurity-making-keypad-lock/
- local accessCode = "0106" -- код доступа
- local component = require("component")
- local gpu = component.gpu
- local event = require("event")
- local ser = require("serialization")
- local term = require("term")
- local computer = component.computer
- local door = component.os_doorcontroller -- Тут поменял component.os_door на component.os_doorcontroller
- keypad = component.keyboard
- customButtons = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "⌫", "0", "Ок"}
- customButtonColor = {"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1"}
- keypad.setKey(customButtons, customButtonColor)
- term.clear()
- print("Хрень китайская")
- print("---------------------------------------------------------------------------")
- local inputStr = ""
- while true do
- ev, address, button, button_label = event.pull("keypad")
- if ev then
- if button_label == "ok" then
- if inputStr == accessCode then
- term.write("Добро пожаловать в наш сладкийцй мир!\n")
- inputStr = "Привет"
- keypad.setDisplay(inputStr)
- door.toggle()
- os.sleep(2)
- door.toggle()
- else
- term.write("Там гетро сексуал или трансгендер\n")
- inputStr = "Хуй тебе"
- keypad.setDisplay(inputStr)
- computer.beep()
- os.sleep(2)
- end
- inputStr = ""
- elseif button_label == "<" then
- if string.len(inputStr) > 0 then
- tmpStr = string.sub(inputStr, 1 , string.len(inputStr) -1)
- inputStr = tmpStr
- end
- else
- inputStr = inputStr .. button_label
- end
- keypad.setDisplay(inputStr)
- end
- os.sleep(0)
- end
Add Comment
Please, Sign In to add comment