Advertisement
Marlingaming

Automated Transfer Script Version 1

Dec 2nd, 2021
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. local TransferMethod = "Withdraw"
  2. local Amount = 0
  3. local SecurityCode = 0
  4. local AccountName = 'guest'
  5. local AccountBalance = 0
  6. local AccountID = 0
  7. local Account Protocol = 0
  8. local AccountKey = 0
  9. local DriveSide = 'n'
  10. local RedstoneSide = 'top'
  11. local ActiveTicks = 2
  12.  
  13. GetSecurityCode()
  14. GetAccountDetails()
  15. if DriveSide == 'n' then
  16. print("Couldnt Find Disk Drive")
  17. os.sleep(5)
  18. os.shutdown()
  19. end
  20. local Drive = peripheral.wrap(DriveSide)
  21. repeat until Drive.isPresent() == true
  22. if Drive.hasMountPath(".Secure_BankingScript") == false then
  23. os.sleep(5)
  24. os.reboot()
  25. local FilePath = Drive.getMountPath(".Secure_BankingScript")
  26. shell.run(FilePath,TransferMethod,Amount,SecurityCode,os.getID)
  27. if Drive.hasMountPath(ID.."_"..TransferMethod.."-Successful") == true then
  28. UpdateAccount()
  29. redstone.setOutput(RedstoneSide,1)
  30. os.sleep(ActiveTicks)
  31. redstone.setOutput(RedstoneSide,0)
  32. elseif Drive.hasMountPath(ID.."_"..TransferMethod.."-Failed") == true then
  33. fs.delete(".Secure_SecurityCode")
  34. fs.delete(".Secure_Account")
  35. end
  36. os.sleep(5)
  37. os.reboot()
  38.  
  39.  
  40.  
  41. local function GetSecurityCode()
  42. local file = fs.open(".Secure_SecurityCode","r")
  43. SecurityCode = file.readAll()
  44. file.close()
  45. end
  46.  
  47. local function GetAccountDetails()
  48. local file = fs.open(".Secure_Account","r")
  49. AccountName = file.readLine()
  50. AccountID = file.readLine()
  51. AccountBalance = file.readLine()
  52. AccountProtocol = file.readLine()
  53. AccountKey = file.readLine()
  54. file.close()
  55. end
  56.  
  57. local function UpdateAccount()
  58. if TransferMethod == "Withdraw" then
  59. AccountBalance = AccountBalance + Amount
  60. elseif TransferMethod == "Deposit" then
  61. AccountBalance = AccountBalance - Amount
  62. end
  63. local file = fs.open(".Secure_Account","w")
  64. file.clear()
  65. file.writeLine(AccountName)
  66. file.writeLine(AccountID)
  67. file.writeLine(AccountBalance)
  68. file.writeLine(AccountProtocol)
  69. file.writeLine(AccountKey)
  70. file.close()
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement