Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- rs.setOutput("bottom",false)
- password = "" -- this is the code you will have the keypad have --
- code = "" --what is currently in the code
- delay = 5 -- the time that the redstone is turned on for --
- output = "bottom" -- side it will turn
- maxnumb = 4
- function k1()
- code = code.."1"
- end
- function k2()
- code = code.."2"
- end
- function k3()
- code = code.."3"
- end
- function k4()
- code = code.."4"
- end
- function k5()
- code = code.."5"
- end
- function k6()
- code = code.."6"
- end
- function k7()
- code = code.."7"
- end
- function k8()
- code = code.."8"
- end
- function k9()
- code = code.."9"
- end
- button.CreateButton(1,2,2,1,1,1,k1,colors.green,"none","")
- button.CreateButton(2,4,4,1,1,1,k2,colors.red,"none","")
- button.CreateButton(3,6,6,1,1,1,k3,colors.yellow,"none","")
- button.CreateButton(4,2,2,3,3,1,k4,colors.pink,"none","")
- button.CreateButton(5,4,4,3,3,1,k5,colors.cyan,"none","")
- button.CreateButton(6,6,6,3,3,1,k6,colors.lime,"none","")
- button.CreateButton(7,2,2,5,5,1,k7,colors.orange,"none","")
- button.CreateButton(8,4,4,5,5,1,k8,colors.blue,"none","")
- button.CreateButton(9,6,6,5,5,1,k9,colors.magenta,"none","")
- while true do
- if code == password then
- button.ClearScreen()
- rs.setOutput(output, true)
- sleep(delay)
- rs.setOutput(output,false)
- code = ""
- elseif string.len(code) > 4 then
- button.ClearScreen()
- button.m.setCursorPos(1,1)
- button.m.write("Wrong")
- button.m.setCursorPos(1,2)
- button.m.write("Code!")
- sleep(2)
- code = ""
- end
- button.DrawButton()
- button.CheckButtons()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement