Advertisement
Nikitos228

пк для печати карт

Aug 26th, 2020
28
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None
  1. local component = require("component")
  2. local term = require("term")
  3. local gsm = require("gsm")
  4. local cardwriter = component.os_cardwriter
  5. local printer = component.openprinter
  6.  
  7. term.clear()
  8.  
  9. function split(s, delimiter)
  10. result = {};
  11. for match in (s..delimiter):gmatch("(.-)"..delimiter) do
  12. table.insert(result, match);
  13. end
  14. return result;
  15. end
  16.  
  17. local BANK_SERVER = "адрес сервера"
  18. local BANK_PORT = 812
  19.  
  20. io.write("Введите имя владельца карты: ")
  21. local owner = io.read()
  22.  
  23. local data = split(gsm.listen(gsm.send(BANK_SERVER, BANK_PORT, "new_card:" .. owner))[5], ":")
  24.  
  25. cardwriter.write(data[2] .. ":" .. data[3] .. ":" .. data[4], data[2] .. " | " .. data[3] .. " | " .. data[4], true, 3)
  26.  
  27. printer.writeln("PIN " .. data[5])
  28. printer.setTitle("PIN-CODE")
  29. printer.print()
  30.  
  31. print("Регистрация банковской карты завершена.\nБанковская карта изготовлена.\nПин-код напечатан.")
Advertisement
RAW Paste Data Copied
Advertisement