Marlingaming

Base Amount TransferScript

Dec 6th, 2021 (edited)
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. --this program gets the arguments given, and proceeds with the given method to modify the given accounts balance
  2. version = "1.0.0"
  3. local tArg = {..}--Amount, Account, Method, Server
  4. local Amount = tArg[0]
  5. local Account = tArg[1]
  6. local Method = tArg[2]
  7. local Server = tArg[3]
  8. local SecurityProtocol = 1000
  9.  
  10. local function EditAccount()
  11. local File = fs.open(Account,"a")
  12. File.nextLine()
  13. local Balance = File.readLine()
  14. File.clearLine()
  15. File.writeLine(Balance + Amount)
  16. File.close()
  17. end
  18.  
  19. local function SendTransfer()
  20. local Modem = peripheral.find("Modem")
  21. rednet.open(Modem)
  22. rednet.send(Server,{Amount,Account},SecurityProtocol)
  23. rednet.close(Modem)
  24. end
  25.  
  26.  
  27. if Method == "Local" then
  28. EditAccount()
  29. elseif Method == "Wireless" then
  30. SendTransfer()
  31. end
Add Comment
Please, Sign In to add comment