Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Security Card Reader
- -- Requires Security Card API
- local lvl1 = "something"
- local lvl2 = "something"
- local pass = "password"
- local disklvl1, disklvl2, diskpass
- if(not card)then
- if(os.loadAPI("card")~=true)then
- error("This program needs the security card API to function")
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- while true do
- print("Needs a security card to function")
- print("Insert a security card to continue...")
- --pullEventRaw stops them from pressing Ctrl-T to terminate
- local event, side = os.pullEventRaw("disk")
- if disk.hasAudio(side) then
- print("Wrong disk type")
- print("Press any key to continue...")
- os.pullEventRaw("key")
- else
- break
- end
- end
- term.scroll(1)
- term.write("Reading")
- textutils.slowPrint("...")
- disklvl1,disklvl2,diskpass = card.getDiskLevel("bottom")
- if(disklvl1~=false)then
- if(disklvl1==lvl1 and disklvl2==lvl2 and diskpass==pass)then
- --Do Something example turns all rs outputs on for 5 seconds
- for n,sSide in ipairs(rs.getSides())do
- rs.setOutput(sSide,true)
- end
- sleep(5)
- for n,sSide in ipairs(rs.getSides())do
- rs.setOutput(sSide,false)
- end
- else
- print("Wrong Security Card")
- end
- else
- print("Unable to read security card")
- end
- os.unloadAPI("card")
- --Good Programming Practice :)
Advertisement
Add Comment
Please, Sign In to add comment