Advertisement
MrSnake20_15

Card_reader

May 26th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1. local com = require('component')
  2. local term = require('term')
  3. local event = require('event')
  4. local magcard = com.os_magreader
  5. local red = com.redstone
  6. local computer = require('computer')
  7. local perm = 'root'
  8. local creator = "MrSnake20_15"
  9. function card()
  10. e = {event.pull('magData')}
  11. nick = e[3]
  12. data = e[4]
  13.   print("------------------------------------------------------------")
  14.   print(nick .. ' пытается войти. Его уровень доступа: <' .. data .. ">.")
  15.     if data == perm then
  16. red.setOutput(2,50)
  17.       print("Дверь открыта.")
  18.       os.sleep(0.1)
  19. red.setOutput(2,0)
  20.       print("Дверь закрыта.")
  21.       print("------------------------------------------------------------")
  22.     else
  23. computer.beep(2000,3)
  24.       print(nick .. " doesn't have permission for this. Required access level <" .. perm .. ">.")
  25.     end
  26. end
  27. term.clear()
  28. print("-------------------- [SECURITY SYSTEM] --------------------")
  29. print(" CREATED BY " .. creator)
  30. print("------------------------- [STARTED] -----------------------")
  31. while true do
  32. card()
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement