Advertisement
Baennon

Security Card Door

Aug 25th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. while true do  
  2.   if not fs.exists("config.cfg") then
  3.     local f = fs.open("config.cfg","w")
  4.     print ("What is the gate's accreditation level ? ")
  5.     local lvl = read()
  6.     f.write(lvl)
  7.     f.close()
  8.   end
  9.  
  10.  local _, side = os.pullEvent("disk")
  11.  local f = fs.open("config.cfg","r")
  12.  local lvl = f.readLine()
  13.  f.close()
  14.  
  15.    if fs.exists("disk/lvl.info") then
  16.      local f2 = fs.open("disk/lvl.info","r")
  17.      local l = f2.readLine()
  18.      f2.close()
  19.      l = tonumber(l)
  20.      lvl = tonumber(lvl)
  21.      print(lvl)
  22.      print(l-lvl)
  23.      if l-lvl >= 0 then
  24.        rs.setOutput("bottom",true)
  25.        disk.eject(side)
  26.        sleep(3)
  27.        rs.setOutput("bottom",false)
  28.      end
  29.    end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement