Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Variables--
- local UserAccount
- local userPIN
- local userBalance
- local otherAccount
- local otherPIN
- local otherBalance
- local input
- local senderId
- local message
- local protocol
- --Setup Networking--
- rednet.open("back")
- --Basic Functions--
- local function Clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- local function SendMoney()
- Clear()
- term.write("Input Account Name:")
- term.setCursorPos(1,2)
- userAccount = read()
- term.setCursorPos(1,3)
- term.write("Input Account To Send Money To:")
- term.setCursorPos(1,4)
- otherAccount = read()
- term.write("Input Amount Of Money To Send:")
- term.setCursorPos(1,6)
- amount = read()
- term.setCursorPos(1,7)
- term.write("Enter PIN:")
- term.setCursorPos(1,8)
- userPIN = read("*")
- rednet.send(5, "SendMoney", "bankFunction")
- senderId, message, protocol = rednet.receive("confirmation")
- if message == "confirmed" then
- rednet.send(5, userAccount,"bankSend")
- else
- clear()
- term.write("Connection To Bank Server Not Established")
- os.sleep(3)
- os.reboot()
- end
- senderId, message, protocol = rednet.receive("confirmation")
- if message == "confirmed" then
- rednet.send(5, otherAccount,"bankSend")
- else
- clear()
- term.write("Connection To Bank Server Not Established")
- os.sleep(3)
- os.reboot()
- end
- senderId, message, protocol = rednet.receive("confirmation")
- if message == "confirmed" then
- rednet.send(5, amount,"bankSend")
- else
- clear()
- term.write("Connection To Bank Server Not Established")
- os.sleep(3)
- os.reboot()
- end
- senderId, message, protocol = rednet.receive("confirmation")
- if message == "confirmed" then
- rednet.send(5, userPIN,"bankSend")
- else
- clear()
- term.write("Connection To Bank Server Not Established")
- os.sleep(3)
- os.reboot()
- end
- senderId, message, protocol = rednet.receive("bankStatus")
- Clear()
- term.write(message)
- os.sleep(3)
- os.reboot()
- end
- local function CheckBalance()
- Clear()
- term.write("Input Account Name:")
- term.setCursorPos(1,2)
- userAccount = read()
- term.setCursorPos(1,3)
- term.write("Enter PIN:")
- term.setCursorPos(1,4)
- userPIN = read("*")
- rednet.send(5, "CheckBalance", "bankFunction")
- senderId, message, protocol = rednet.receive("confirmation")
- if message == "confirmed" then
- rednet.send(5, userAccount,"balanceCheck")
- else
- clear()
- term.write("Connection To Bank Server Not Established")
- os.sleep(3)
- os.reboot()
- end
- senderId, message, protocol = rednet.receive("confirmation")
- if message == "confirmed" then
- rednet.send(5, userPIN,"balanceCheck")
- else
- clear()
- term.write("Connection To Bank Server Not Established")
- os.sleep(3)
- os.reboot()
- end
- senderId, message, protocol = rednet.receive("bankStatus")
- if message ~= "confirmed" then
- Clear()
- term.write(message)
- os.sleep(3)
- os.reboot()
- else
- senderId, message, protocol = rednet.receive("bankCheck")
- Clear()
- term.write("Your Balance Is: " .. message)
- term.setCursorPos(1,2)
- term.write("Press Any Key To Continue")
- os.pullEvent("key")
- os.reboot()
- end
- end
- Clear()
- term.write("1). Send Money")
- term.setCursorPos(1,2)
- term.write("2). Check Balance")
- term.setCursorPos(1,3)
- input = read()
- if input == "1" then
- SendMoney()
- elseif input == "2" then
- CheckBalance()
- else
- os.reboot()
- end
Add Comment
Please, Sign In to add comment