Advertisement
MrUndead

Card.lua

Jan 26th, 2022 (edited)
961
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local writer = require("component").os_cardwriter
  2. local component = require("component")
  3. local term = require("term")
  4. local event = require("event")
  5. local Data = component.data
  6. local m = component.modem
  7.  
  8. local PortO = 123
  9. local ServerA = "158e29fe-4f83-42b5-8837-1bddad8fadc4"
  10.  
  11. local function myFunction(eventName, address, playerName, cardData,
  12.                           cardUniqueId, isCardLocked, side)
  13.     print(
  14.         "player" .. playerName .. " used card " .. cardUniqueId .. ", data: " ..
  15.             cardData)
  16.     term.clear()
  17.     os.exit()
  18. end
  19.  
  20. term.clear()
  21.  
  22. io.write("The name of the card: ")
  23. Name = io.read()
  24. io.write("Enter a Password for the card: ")
  25. UnPass = io.read()
  26. Pass = Data.encode64(UnPass)
  27. writer.write(Pass, Name, false)
  28.  
  29. m.open(PortO)
  30. m.send(ServerA, PortO, Name, Pass)
  31.  
  32. term.clear()
  33.  
  34. io.write("Take the card and swipe it to activate it. \n")
  35. event.listen("magData", myFunction)
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement