Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local username
- local password
- local uninput
- local pwinput
- local input
- local redoutput = "top"
- os.pullEvent = os.pullEventRaw
- function stop(int)
- sleep(int)
- term.clear()
- term.setCursorPos(1,1)
- end
- function setcredentials()
- print("Enter New Username:")
- username = read()
- print("Enter New Password:")
- password = read("*")
- print("Credentials Set")
- stop(1)
- choisemenu()
- end
- function setpassword()
- print("Enter Old Password:")
- pwinput = read("*")
- if pwinput == password then
- print("Enter New Pasword:")
- password = read("*")
- print("Password Succesfully Changed")
- stop(1)
- choisemenu()
- else
- print("Incorrect Password\nTry Again")
- stop(1)
- setpassword()
- end
- end
- function checkcredentials()
- print("Enter Username:")
- uninput = read()
- print("Enter Password:")
- pwinput = read("*")
- stop(0)
- if uninput == username and pwinput == password then
- print("Credentials Correct")
- stop(1)
- choisemenu()
- else
- print("Credentials Incorrect")
- stop(1)
- checkcredentials()
- end
- end
- function choisemenu()
- print("Choises:\n1: Change Password\n2: Give Redstone Output\n3: Change Redstone Output Side\n4: Logout\n5: Reboot\n")
- input = read()
- if input == "1" then
- stop(0)
- setpassword()
- elseif input == "2" then
- stop(0)
- rs.setOutput(redoutput, true)
- sleep(5)
- rs.setOutput(redoutput, false)
- checkcredentials()
- elseif input == "3" then
- stop(0)
- setredstone()
- elseif input == "4" then
- stop(0)
- checkcredentials()
- elseif input == "5" then
- shell.run("reboot")
- else
- stop(0)
- print("Input Incorrect")
- stop(1)
- choisemenu()
- end
- end
- function firstrun()
- print("Copyright RIPsac 2017\n\nWelcome to the RepsacPasswordLock programm\n\n(Default Redstone Side Output = top)\n\nPress any key to setup programm")
- os.pullEvent("key")
- stop(1)
- setcredentials()
- end
- function setredstone()
- print("On which side do you want your redstone output?\nInput: left, right, back, front, bottom, top")
- redoutput = read()
- stop(1)
- choisemenu()
- end
- stop(0)
- firstrun()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement