Advertisement
daniel41550

Untitled

Jul 28th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. password = "complab"
  2. debug_char = "0"
  3.  
  4. term.clear()
  5.  
  6. function mainLoop()
  7. while(true) do
  8. event, driveSide = os.pullEventRaw()
  9. if(event=="disk" and driveSide) then
  10. path = disk.getMountPath(driveSide)
  11. if(path) then
  12. path = path.."/access3"
  13. file = fs.exists(path) and io.open(path, "r") or nil
  14. end
  15. disk.eject(driveSide)
  16. if(file and file:read()==password) then
  17. rs.setOutput("right", true)
  18. sleep(3)
  19. rs.setOutput("right", false)
  20. end
  21. if(file) then file:close() file = nil end
  22. elseif(debug_char and event=="char" and driveSide==debug_char) then return("break") end
  23. end
  24. end
  25.  
  26. rs.setOutput("right", false)
  27. sfile = io.open("/startup", "w")
  28. sfile:write('shell.run("keycard")')
  29. sfile:close()
  30.  
  31. repeat
  32. ok, err, val = pcall(mainLoop)
  33. if(not ok and err) then
  34. if(err=="Terminated") then print ("Access denied.")
  35. else
  36. print(err)
  37. end
  38. end
  39. until(ok and err=="break")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement