Legrandfifou

Mag-card reader

Oct 28th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. -- Original code by "http://www.computercraft.info/forums2/index.php?/topic/3728-mc-164-cc-158-immibiss-peripherals/"
  2. local status = {"<Enter Card>","<Rejected>","<Granted>"}
  3. local current = 1
  4. local combo = "#Code que vous avez entré lors de la création de la carte"
  5. local lastTimer
  6. while true do
  7. local event,arg1,arg2,arg3 = os.pullEvent()
  8. if event == "timer" and arg1 == lastTimer then
  9.   current = 1
  10.   lastTimer = nil
  11.   rs.setOutput("coté d'ou sortira la redstone",false)
  12. elseif event == "mag_swipe" then
  13.   if arg1 == combo then
  14.    lastTimer = os.startTimer(3)
  15.    current = 3
  16.    rs.setOutput("coté d'ou sortira la redstone",true)
  17.   else
  18.    lastTimer = os.startTimer(3)
  19.    current = 2
  20.   end
  21. end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment