Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- local tArg = {...}
- local Reader = peripherals.find("reader")
- rednet.open(peripherals.find("modem"))
- local VertifyState = "unvertified"
- local ServerId
- local Key = "0000"
- local Amount = tArg[1]
- local Item = tArg[2]
- local function Clear()
- term.setBackgroundColor(colors.lightBlue)
- term.clear()
- term.setCursorPos(1,1)
- print("|",VertifyState,"| Banking System | banking_public3 | ")
- end
- function Getkey()
- centerText(h/2, "Please Enter Pin")
- term.setCursorPos(5,(h/2) + 1)
- local input
- repeat
- input = read("*")
- until string.len(input) == 4
- Key = input
- end
- function GetCard()
- centerText(h/2, "Please Swipe Card Now")
- local side, id, data = os.pullEvent("mag_swipe")
- centerText(h/2, "Vertifying Card")
- local Mes = {id,data,Key,Amount,Item}
- rednet.send(ServerId,textutils.serialize(Mes),"4523")
- local a, b, c = rednet.receive("4523")
- if a == ServerId and b == "accepted" then
- os.queueEvent("Transaction_Accepted")
- elseif a == ServerId and b == "declined" then
- os.queueEvent("Transaction_Declined","Rejected by Server")
- end
- end
- function getServer()
- ServerId = rednet.lookup("4523","Ser_B_1")
- end
- getServer()
- if Amount > 40 then
- Getkey()
- end
- GetCard()
Add Comment
Please, Sign In to add comment