Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Configuration
- -- Strings
- -- Passwords
- local sBypasspw = "bypass"
- local sDoorpw = "door"
- local sRedstoneSide = "back"
- local sAlarmSide = "left"
- local sMasterpw = "master"
- local sAlarmInput = ""
- local sTeslaSide = "bottom"
- local sTesla = "yes"
- -- Names
- local sVillageName = "derpington"
- -- Values
- -- Door values
- local tDoor = 5
- local tBypass = 15
- local nWrongTimes = 3
- local nWrongCount = 0
- -- Do not edit from here
- -- Functions
- function clearPrint(string, x, y)
- if not x or x < 0 then x = 1 end
- if not y or y < 0 then y = 1 end
- term.clear()
- term.setCursorPos(x,y)
- print(string)
- end
- -- if statement
- function checkPW(PW)
- if PW == sDoorpw then
- clearPrint("Password correct! Please proceed - door will close in "..tDoor.." seconds.")
- rs.setOutput(sRedstoneSide,false)
- sleep(tDoor)
- rs.setOutput(sRedstoneSide,true)
- clearPrint("Door closed!")
- sleep(1.5)
- elseif PW == sBypasspw then
- clearPrint("System Bypassed. Gate will remain open for "..tBypass.." seconds. Please proceed.")
- rs.setOutput(sRedstoneSide,false)
- sleep(tBypass)
- rs.setOutput(sRedstoneSide,true)
- clearPrint("Door closed!")
- sleep(1.5)
- else
- clearPrint("Password incorrect! Please try again")
- sleep(1)
- nWrongCount = nWrongCount + 1
- if nWrongCount == nWrongTimes then
- if sTesla == "yes" then
- rs.setOutput(sAlarmSide,true)
- clearPrint("Alarms Activated!")
- sleep(1.8)
- rs.setOutput(sTeslaSide,true)
- clearPrint("HAHA DIE BITCH!")
- sleep(3)
- rs.setOutput(sAlarmSide,false)
- rs.setOutput(sTeslaSide,false)
- nWrongCount = 0 -- resets wrong count
- else
- while sAlarmInput ~= sMasterpw do
- rs.setOutput(sAlarmSide,true) -- activates alarm
- clearPrint("Alarms activated! Please enter Master password to de-activate alarms.")
- write("Master password: ")
- sAlarmInput = read()
- end
- clearPrint("De-activated alarms...")
- sleep(1)
- nWrongCount = 0 -- resets wrong count
- sAlarmInput = ""
- rs.setOutput(sAlarmSide,false) -- deactivates alarm
- end
- nWrongCount = 0
- end -- end if function for wrong times
- end
- end
- while true do
- clearPrint("Welcome to "..sVillageName..", user.")
- write("Enter password to open gate: ")
- rs.setOutput(sRedstoneSide,true)
- if checkPW(read()) == sBypasspw then break end
- end
Advertisement
Add Comment
Please, Sign In to add comment