Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- The Programm is not working at the moment because it uses to much Resources
- and Crashes because of that Ingame. I will edit it in the near Future and also
- Make it more diverse.
- Some Examples:
- - Making it possible to change Color of the Messages
- - Making Alarm System more Userfriendly. (Permanent Redstone Signal etc)
- - Making LockDown Mode Saves failed tries after Shutdown and Reboot.
- - Create an Dummy Password
- - A Settings Menu <Maybe>
- - more coming soon..
- ]]--
- -- Main Settings:
- -- Password to open the Door.
- DoorPass = "Password"
- -- Password to get into the Pc.
- MasterPass = "Password"
- -- Side the Redstone should be Output to Activate the Door.
- DoorSide = "Side"
- -- Amount of time the Door should be kept Open.
- rsTime = "Amount"
- -- Amount of time befor the Door will Open.
- DoorDelay = "Amount"
- -- Displayed Messages:
- -- Message that appears when System Starts.
- StartMSG = "Input Passwort: "
- -- Message that appears when Password was Correct.
- CorrectMSG = "Access Granted"
- -- Message that appears when Password was Incorrect.
- WrongMSG = "Access Denied"
- -- Message that appears when the MasterPassword is used.
- MasterMSG = "Programm shutting down"
- -- Toggable Features:
- -- Alarm System (SEPERAT Redstone Connection needed)
- -- Toogles if the Alarm can be used.
- Alarm = false
- -- Password to Deactivate the Alarm.
- AlarmOffPass = "Password"
- -- Where the Connection of the Alarm Redstone is.
- AlarmSide = "Side"
- -- Message that appears when the Alarm is Deactivated.
- AlarmMSG = "Alarm deactivated"
- -- System with a fixed amount of tries.
- -- Toggles if LockDown Mode works.
- LockSystem = false
- -- Password to Deactivated LockDown Mode.
- SecurityPass = "Password"
- -- Amount of tries a Player has befor SecurityMode will be activated.
- Tries = 3
- -- Message that appears when LockDownMode is active.
- LockDownMSG = "System is in Lockdown.\nInput Password: "
- -- Maintance System (As an way to save the entry to the redstone part of the build)
- -- Toggles if Maintance can be used
- Maintance = false
- -- Password to toggle the Maintance System
- MaintancePass = "Password"
- -- Side wherer the connection of the Maintance is
- MaintanceSide = "Side"
- -- Message that appears when Maintance is activated
- MaintanceMSG = "Toggled MaintanceMode"
- -- Do not edit after this part, except you know what you are doing.
- os.pullEvent = os.pullEventRaw
- -- Counts the amount of failed tries made.
- CountTry = {}
- -- Checks which Mode Maintance is.
- MaintanceMode = {}
- -- Clears the Screen and Puts the Cursor to the Top Left.
- local function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- -- Function to Activate the Redstone for the Door.
- local function rsDoor()
- sleep(DoorDelay)
- rs.setOutput(DoorSide, true)
- sleep(rsTime)
- rs.setOutput(DoorSide, false)
- end
- -- Saves failed Tries
- local function SaveTries()
- fs.makeDir("DoorLock")
- fs.open("DoorLock/SaveData","w")
- file.writeLine(CountTry)
- file.close()
- end
- -- Load failed tries
- local function LoadTries()
- local Number = {}
- fs.open("DoorLock/SaveData","r")
- file.readLine()
- table.insert(Number,line)
- file.close()
- CountTry = CountTry + Number
- end
- -- Saves Maintance Mode
- local function SaveMaintance()
- fs.open("DoorLock/Maintance","w")
- file.wirteLine(MaintanceMode)
- file.close()
- end
- -- Load Maintance Mode
- local function LoadMaintance()
- local Mode = {}
- fs.open("DoorLock/Maintanc","r")
- file.readLine()
- table.insert(Mode,line)
- file.close()
- MaintanceMode = Mode
- end
- -- Initiates the LockDown Mode.
- local function LockDown()
- if CountTry >= Tries and LockSystem == true then
- return true
- end
- end
- -- Main Code:
- -- Start Position of the Programm
- function Main()
- print(StartMSG)
- input = read("*")
- while true do
- LoadTries()
- LoadMaintance()
- -- Compares Input to the given Situations
- if input == DoorPass and LockDown() == false then
- clear()
- print(CorrectMSG)
- rsDoor()
- CountTry = CountTry - CountTry
- clear()
- SaveTries()
- Main()
- elseif input == SecurityPass and LockDown() == true then
- clear()
- print(CorrectMSG)
- sleep(3)
- CountTry = CountTry - CountTry
- clear()
- SaveTries()
- Main()
- elseif input == MasterPass then
- clear()
- print(MasterMSG)
- sleep(2)
- SaveTries()
- Main()
- elseif input == AlarmOffPass and Alarm == true then
- clear()
- print(AlarmMSG)
- sleep(2)
- rs.setOutput(AlarmSide, true)
- clear()
- SaveTries()
- Main()
- elseif input == MaintancePass and Maintance == true and MaintanceMode == false then
- clear()
- print(MaintanceMSG)
- sleep(2)
- rs.setOutput(MaintanceSide, true)
- MaintanceMode = true
- SaveMaintance()
- clear()
- SaveTries()
- Main()
- elseif input == MaintancePass and Maintanc == true and MaintanceMode == true then
- clear()
- print(MaintanceMSG)
- sleep(2)
- rs.setOutput(MaintanceSide, false)
- MaintanceMode = false
- SaveMaintance()
- clear()
- SaveTries()
- Main()
- else
- clear()
- if Alarm == true then
- rs.setOutput(AlarmSide, true)
- end
- print(WrongMSG)
- sleep(3)
- CountTry = CountTry + 1
- clear()
- SaveTries()
- Main()
- end
- end
- end
Add Comment
Please, Sign In to add comment