Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Made by Alexmaster75
- This program allows the player to activate a redstone
- contraption by a username and password protection.
- Download this with the command "pastebin get BQgDkJve startup.lua"
- and reboot. This will make the computer load the program every time
- it is started up. Change the US and PW variables content to
- personalize the program and make it more secure.
- ]]--
- local monitor = peripheral.find("monitor")
- local US = "Username"
- local PW = "admin"
- local user = ""
- local pwd = ""
- if monitor then
- term.redirect(monitor)
- end
- local w,h = term.getSize()
- term.clear()
- term.setCursorPos(1,1)
- print("LIMITED ACCESS ZONE")
- for i=1,w do
- write("-")
- end
- print()
- textutils.slowWrite("Username: ")
- user = read()
- textutils.slowWrite("Password: ")
- pwd = read("*")
- local x,y = term.getCursorPos()
- while true do
- term.setCursorPos(1,y)
- if user == US and pwd == PW then
- textutils.slowWrite("ACCESS GRANTED")
- -- Pay attention to this part as it is the redstone output.
- -- Change the "..." to ant name like left, right, top, bottom, ...
- rs.setOutput("left", true)
- os.sleep(4)
- rs.setOutput("left", false)
- -- /\
- else
- textutils.slowWrite("Username or Password not correct, please retry...")
- os.sleep(8)
- end
- os.reboot()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement