RemiCraft

POS API

Jul 8th, 2022 (edited)
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.56 KB | None | 0 0
  1. --Variables--
  2. local userAccount
  3. local otherAccount
  4. local amount
  5. local userPIN
  6. local input
  7.  
  8. local senderId
  9. local message
  10. local protocol
  11.  
  12. --Setup Networking--
  13. rednet.open("back")
  14.  
  15. function SendMoney(user, other, cost, pin)
  16.     userAccount = user
  17.     otherAccount = other
  18.     amount = cost
  19.     userPIN = pin
  20.     rednet.send(11, "SendMoney", "bankFunction")
  21.     senderId, message, protocol = rednet.receive("confirmation")
  22.     if message == "confirmed" then
  23.         rednet.send(11, userAccount,"bankSend")
  24.     else
  25.         term.write("Connection To Bank Server Not Established")
  26.         os.sleep(3)
  27.         os.reboot()
  28.     end
  29.     senderId, message, protocol = rednet.receive("confirmation")
  30.     if message == "confirmed" then
  31.         rednet.send(11, otherAccount,"bankSend")
  32.     else
  33.         term.write("Connection To Bank Server Not Established")
  34.         os.sleep(3)
  35.         os.reboot()
  36.     end
  37.     senderId, message, protocol = rednet.receive("confirmation")
  38.     if message == "confirmed" then
  39.         rednet.send(11, amount,"bankSend")
  40.     else
  41.         term.write("Connection To Bank Server Not Established")
  42.         os.sleep(3)
  43.         os.reboot()
  44.     end
  45.     senderId, message, protocol = rednet.receive("confirmation")
  46.     if message == "confirmed" then
  47.         rednet.send(11, userPIN,"bankSend")
  48.     else
  49.         term.write("Connection To Bank Server Not Established")
  50.         os.sleep(3)
  51.         os.reboot()
  52.     end
  53.     senderId, message, protocol = rednet.receive("bankStatus")
  54.     term.write(message)
  55.     os.sleep(3)
  56.     os.reboot()
  57. end
Add Comment
Please, Sign In to add comment