Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component=require("component")
- local term=require("term")
- local text=require("text")
- local computer=require("computer")
- local os=require("os")
- local alarm=component.os_alarm
- local rs=component.redstone
- local gpu=component.gpu
- ----Config----
- local delay1=7 --The delay what the redstone is on for (1)
- local delay2=7 --The delay what the redstone is on for (2)
- local delaywrong=3
- local side1=0 --The redstone side (1)
- local side2=0 --The redstone side (2)
- local username1="001" --Username (1)
- local username2="002" --Username (2)
- local password1="federal" --Password (1)
- local password2="reserve" --Password (2)
- local usernameline=31
- local passwordline=36
- local firstmsg="Unity City Federal Reserve" --The message that appears when the program is started
- local username="Please enter your badgenumber:"
- local password="Please enter your personal password"
- local passwordwrong="Wrong password!"
- local usernamewrong="Wrong badgenumber"
- local alarmrange=150
- ---- ---- ----
- alarm.setRange(alarmrange)
- while true do
- term.clear()
- gpu.set(1,1,firstmsg)
- term.setCursor(1,2)
- gpu.set(1,3,username)
- term.setCursor(usernameline,3)
- local username=io.read()
- if username==username1 then
- gpu.set(1,4,password)
- term.setCursor(passwordline,4)
- local password = text.trim(term.read(nil, false, nil, "*"))
- if password==password1 then
- alarm.deactivate()
- rs.setOutput(1,15)
- os.sleep(delay1)
- rs.setOutput(1,0)
- else
- if username==username2 then
- term.setCursor(passwordline,4)
- local password = text.trim(term.read(nil, false, nil, "*"))
- if password==password2 then
- alarm.deactivate()
- rs.setOutput(2,15)
- os.sleep(delay2)
- rs.setOutput(2,0)
- else
- gpu.set(1,6,passwordwrong)
- alarm.activate()
- os.sleep(delaywrong)
- end
- else
- gpu.set(1,6,usernamewrong)
- os.sleep(delaywrong)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement