Posted 11 June 2012 - 11:19 PM
for a floppy key card to open a door this is what i have seen but i don't know how to run it or put it in the computer
[left]password = "password"[/left]
[left]debug_char = "0"[/left]
[left]term.clear()[/left]
[left]function mainLoop()[/left]
[left]while(true) do[/left]
[left]event, driveSide = os.pullEventRaw()[/left]
[left]if(even=="disk" and driveSide) then[/left]
[left]path = disk.getMountPath(driveSide)[/left]
[left]if(path) then[/left]
[left]path = path.."/access"[/left]
[left]file = fs.exists(path) and io.open(path, "r") or nil[/left]
[left]end[/left]
[left]disk.eject(driveSide)[/left]
[left]if(file and file:read()==password) then[/left]
[left]rs.setOutput("left", true)[/left]
[left]sleep(3)[/left]
[left]rs.setOutput("left", false)[/left]
[left]end[/left]
[left]if(file) then file:close() file = nil end[/left]
[left]elseif(debug_char and event=="char" and driveSide==debug_char) then return("break") end[/left]
[left]end[/left]
[left]end[/left]
[left]rs.setOutput("left", false)[/left]
[left]sfile = io.open("/startup", "w")[/left]
[left]sfile:write('shell.run("keycard")')[/left]
[left]sfile:close()[/left]
[left]repeat[/left]
[left]ok, err, val = pcall(mainLoop)[/left]
[left]if(not ok and err) then[/left]
[left]if(err=="Terminated") then print ("Access denied.")[/left]
[left]else[/left]
[left]print(err)[/left]
[left]end[/left]
[left]end[/left]
[left]until(ok and err=="break")[/left]
[left]password = "password"[/left]
[left]debug_char = "0"[/left]
[left]term.clear()[/left]
[left]function mainLoop()[/left]
[left]while(true) do[/left]
[left]event, driveSide = os.pullEventRaw()[/left]
[left]if(even=="disk" and driveSide) then[/left]
[left]path = disk.getMountPath(driveSide)[/left]
[left]if(path) then[/left]
[left]path = path.."/access"[/left]
[left]file = fs.exists(path) and io.open(path, "r") or nil[/left]
[left]end[/left]
[left]disk.eject(driveSide)[/left]
[left]if(file and file:read()==password) then[/left]
[left]rs.setOutput("left", true)[/left]
[left]sleep(3)[/left]
[left]rs.setOutput("left", false)[/left]
[left]end[/left]
[left]if(file) then file:close() file = nil end[/left]
[left]elseif(debug_char and event=="char" and driveSide==debug_char) then return("break") end[/left]
[left]end[/left]
[left]end[/left]
[left]rs.setOutput("left", false)[/left]
[left]sfile = io.open("/startup", "w")[/left]
[left]sfile:write('shell.run("keycard")')[/left]
[left]sfile:close()[/left]
[left]repeat[/left]
[left]ok, err, val = pcall(mainLoop)[/left]
[left]if(not ok and err) then[/left]
[left]if(err=="Terminated") then print ("Access denied.")[/left]
[left]else[/left]
[left]print(err)[/left]
[left]end[/left]
[left]end[/left]
[left]until(ok and err=="break")[/left]