Advertisement
RemiCraft

POS Cashier

Jul 8th, 2022 (edited)
1,033
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.99 KB | None | 0 0
  1. --Variables--
  2. local UserAccount
  3. local userPIN
  4. local otherAccount = "Business Account Here"
  5. local input
  6.  
  7. local senderId
  8. local message
  9. local protocol
  10.  
  11. --Setup Networking--
  12. rednet.open("back")
  13.  
  14. --Basic Functions--
  15. local function Clear()
  16.     term.clear()
  17.     term.setCursorPos(1,1)
  18. end
  19.  
  20. local function SendMoney()
  21.     Clear()
  22.     term.write("Input Total Amount:")
  23.     term.setCursorPos(1,2)
  24.     amount = read()
  25.     term.setCursorPos(1,3)
  26.     term.write("Input Account Name:")
  27.     term.setCursorPos(1,4)
  28.     UserAccount = read()
  29.     term.setCursorPos(1,5)
  30.     term.write("Enter PIN:")
  31.     term.setCursorPos(1,6)
  32.     userPIN = read("*")
  33.     rednet.send(11, "SendMoney", "bankFunction")
  34.     senderId, message, protocol = rednet.receive("confirmation")
  35.     if message == "confirmed" then
  36.         rednet.send(11, userAccount,"bankSend")
  37.     else
  38.         clear()
  39.         term.write("Connection To Bank Server Not Established")
  40.         os.sleep(3)
  41.         os.reboot()
  42.     end
  43.     senderId, message, protocol = rednet.receive("confirmation")
  44.     if message == "confirmed" then
  45.         rednet.send(11, otherAccount,"bankSend")
  46.     else
  47.         clear()
  48.         term.write("Connection To Bank Server Not Established")
  49.         os.sleep(3)
  50.         os.reboot()
  51.     end
  52.     senderId, message, protocol = rednet.receive("confirmation")
  53.     if message == "confirmed" then
  54.         rednet.send(11, amount,"bankSend")
  55.     else
  56.         clear()
  57.         term.write("Connection To Bank Server Not Established")
  58.         os.sleep(3)
  59.         os.reboot()
  60.     end
  61.     senderId, message, protocol = rednet.receive("confirmation")
  62.     if message == "confirmed" then
  63.         rednet.send(11, userPIN,"bankSend")
  64.     else
  65.         clear()
  66.         term.write("Connection To Bank Server Not Established")
  67.         os.sleep(3)
  68.         os.reboot()
  69.     end
  70.     senderId, message, protocol = rednet.receive("bankStatus")
  71.     Clear()
  72.     term.write(message)
  73.     os.sleep(3)
  74.     os.reboot()
  75. end
  76.  
  77. SendMoney()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement