Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This code is copirighted and made by KOD_28 !
- -- If you use publically you must quote its author
- -- This code is meant to be used with the mod ComputerCraft for Minecraft
- -- Before using the program you must go to root directory ( cd / )
- -- Then create a data directory ( mkdir data )
- -- then go in it ( cd data ) and create a pswd file ( edit pswd )
- -- Inside pswd just write your password and save/exit the file
- -- Then you can run the program and have fun with it ;)
- local pullEvent = os.pullEventRaw -- These two lines prevent someone to stop your program using CTRL + T
- os.pullEvent = os.pullEventRaw
- local door = "left" -- This is the side of your output to the door
- local jukebox = "right" -- This is the side where the disk drive used in guest function is attached to your computer
- local otme = 5 -- otme = opentime, it's the time the door is openned
- local ptme = 30 -- ptme = playtime, it's the time the computer plays the cd in the disk drive for the guest function
- local guest = "guest"
- local admin = "admin"
- local adminpswd = "your admin password" -- This is your Admin pswd you can change as you want
- local pswdFile = fs.open("/data/pswd", "r")
- pswd = pswdFile:readLine()
- pswdFile.close()
- --Instead of explain all the function, I'll let you try the program and understand by yourself ;)
- while true do
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.white)
- print("Hello, please write the password :")
- term.setTextColor(colors.lightGray)
- print("(if you don't know it, write 'guest')")
- term.setCursorPos(34,7)
- term.setTextColor(colors.blue)
- print("-KOD's Softs") -- This is just a copyright inside the program
- term.setCursorPos(1,4)
- term.setTextColor(colors.white)
- local input = read("*")
- if input == pswd then
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.lime)
- print("Welcome !")
- term.setCursorPos(34,7)
- term.setTextColor(colors.blue)
- print("-KOD's Softs") -- This is just a copyright inside the program
- rs.setOutput(door,true)
- sleep(otme)
- rs.setOutput(door,false)
- elseif input == guest then
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.orange)
- print("Wait for someone to open the door")
- term.setCursorPos(34,7)
- term.setTextColor(colors.blue)
- print("-KOD's Softs") -- This is just a copyright inside the program
- disk.playAudio(jukebox)
- sleep(ptme)
- disk.stopAudio(jukebox)
- elseif input == adminpswd then
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.yellow)
- print("Actiated with admin password")
- rs.setOutput(door,true)
- sleep(otme)
- rs.setOutput(door,false)
- elseif input == admin then
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.yellow)
- print("ADMIN MODE")
- print("Enter admin password :")
- term.setCursorPos(1,4)
- local input = read("*")
- if input == adminpswd then
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.yellow)
- print("Choose action")
- term.setCursorPos(1,3)
- print("1 - Close the program")
- print("2 - Edit password")
- term.setCursorPos(1,6)
- local input = read()
- if input == "1" then
- term.clear()
- term.setCursorPos(1,1)
- print("You closed the program")
- break
- elseif input == "2" then
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.yellow)
- print("Enter new password")
- term.setCursorPos(1,3)
- local input = read()
- pswd = input
- local pswdFile = fs.open("/data/pswd", "w")
- pswdFile.write(input)
- pswdFile.close()
- else
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.red)
- print("Wrong input")
- sleep(otme)
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.red)
- print("Wrong admin password")
- sleep(otme)
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.red)
- print("Wrong password")
- term.setCursorPos(34,7)
- term.setTextColor(colors.blue)
- print("-KOD's Softs") -- This is just a copyright inside the program
- sleep(otme)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment