Advertisement
FluttyProger

RfidWrite

Nov 3rd, 2017
230
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local component = require("component")
  2. local writer
  3. if component.isAvailable("os_cardwriter") then
  4. writer = component.os_cardwriter
  5. elseif component.isAvailable("OSCardWriter") then
  6. writer = component.OSCardWriter
  7. else
  8. print("Подключите CardWriter к компьтеру")
  9. os.exit()
  10. end
  11. local success
  12. local args = table.pack(...)
  13.  
  14. if #args < 3 then
  15. print("Data - Данные карты для открытия")
  16. print("Name - Имя карты")
  17. print("isLock - можно_перезаписать_или_нет(true/false)")
  18. print("Использование: RfidWrite Data Name isLock")
  19. os.exit()
  20. end
  21.  
  22. local Data = args[1]
  23. local Name = args[2]
  24. local isLock = args[3]
  25.  
  26. if isLock == "true" then
  27. success = writer.write(Data, Name, true)
  28. elseif isLock == "false" then
  29. success = writer.write(Data, Name, false)
  30. else
  31. print("isLock не true и не false")
  32. os.exit()
  33. end
  34.  
  35. if success then
  36. print("Данные успешно записаны")
  37. else
  38. print("Карта не вставлена")
  39. end
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement