Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Password for door
- local Pass1 = '123'
- local Pass2 = '234'
- -- Admin Password Access to edit program
- local aPass = '1234'
- -- If output normaly high or low
- local NormalyOutput = {
- [1] = true,
- [2] = true
- }
- --Side to output (front,back,left,rigt,bottom,top)
- local Output = {
- [1] = 'right',
- [2] = 'left'
- }
- -- Disable CTRL + T
- -- Setting to false requires a reboot
- local DisableTermination = false
- local input
- local Running = true
- if DisableTermination then
- os.pullEvent = os.pullEventRaw
- end
- function NewText()
- term.clear()
- term.setCursorPos(1,1)
- end
- function SetOutput(state, door)
- if not state then
- for k,v in pairs(Output) do
- redstone.setOutput(v, NormalyOutput[k])
- end
- else
- if NormalyOutput then
- redstone.setOutput(Output[door], not state)
- else
- redstone.setOutput(Output[door], state)
- end
- end
- end
- while Running do
- SetOutput()
- NewText()
- print('Please Enter Password:')
- input = read('*')
- if input == Pass1 then
- NewText()
- print('Opening...')
- SetOutput(true, 1)
- sleep(2.5)
- NewText()
- print('Closing...')
- SetOutput(false, 1)
- sleep(1)
- elseif input == Pass2 then
- NewText()
- print('Opening...')
- SetOutput(true, 2)
- sleep(2.5)
- NewText()
- print('Closing...')
- SetOutput(false, 2)
- sleep(1)
- elseif input == aPass then
- NewText()
- print('Welcome Admin')
- Running = false
- else
- NewText()
- print('Wrong Password')
- sleep(2.5)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement