forked from minecartchris/CC-Casnio
One of the rcc admins sent me the code thx alex
This commit is contained in:
@@ -1 +1,35 @@
|
|||||||
--dima sends me code it goes here
|
--[[
|
||||||
|
Casino ATM and Card Creator
|
||||||
|
Copyright Herr Katze and minecartchris
|
||||||
|
License: MIT
|
||||||
|
]]
|
||||||
|
local nfc = peripheral.find("nfc_reader")
|
||||||
|
local modem = peripheral.find("modem", function(n,w) return not w.isWireless() end)
|
||||||
|
|
||||||
|
rednet.open(peripheral.getName(modem))
|
||||||
|
|
||||||
|
local function createCard(cardId)
|
||||||
|
local timer = os.startTimer(60)
|
||||||
|
local done = false
|
||||||
|
nfc.write("casinoAccount_"..cardId, "Casino Card")
|
||||||
|
while not done do
|
||||||
|
local ev, id = os.pullEvent()
|
||||||
|
print(ev)
|
||||||
|
if ev == "timer" and id == timer then
|
||||||
|
nfc.cancelWrite()
|
||||||
|
rednet.broadcast({type="card_timeout"}, "casinoATMC2S")
|
||||||
|
end
|
||||||
|
if ev == "nfc_write" then done = true end
|
||||||
|
end
|
||||||
|
rednet.broadcast({type="card_created"}, "casinoATMC2S")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function rednetListener()
|
||||||
|
rednet.host("nfc_atm_write",tostring(os.getComputerID()))
|
||||||
|
while true do
|
||||||
|
local id, message =rednet.receive("nfc_atm_write")
|
||||||
|
createCard(message)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
rednetListener()
|
||||||
|
|||||||
Reference in New Issue
Block a user