Feldherren

Insecure Door RFID

May 9th, 2019
674
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. local tArgs = { ... }
  2. if #tArgs ~= 1 then
  3.     print( "Usage: rfid_door <redstone_side>" )
  4.     return
  5. end
  6.  
  7. if (tArgs[1] ~= "front") and (tArgs[1] ~= "back") and (tArgs[1] ~= "top") and (tArgs[1] ~= "bottom") and (tArgs[1] ~= "left") and (tArgs[1] ~= "right") then
  8.     print( "Please specify a valid side: front, back, top, bottom, left or right" )
  9.     return
  10. end
  11.  
  12. local redstone_side = tArgs[1]
  13.  
  14. local rfid_rw = peripheral.find("rfid_reader_writer")
  15.  
  16. while true do
  17.     local rfid = rfid_rw.search()
  18.     if rfid ~= nil then
  19.         print(rfid)
  20.         if not redstone.getOutput(redstone_side) then
  21.             redstone.setOutput(redstone_side, true)
  22.         end
  23.     else
  24.         redstone.setOutput(redstone_side, false)
  25.     end
  26.     sleep(1)
  27. end
Advertisement
Add Comment
Please, Sign In to add comment