Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TransferMethod = "Withdraw"
- local Amount = 0
- local SecurityCode = 0
- local AccountName = 'guest'
- local AccountBalance = 0
- local AccountID = 0
- local Account Protocol = 0
- local AccountKey = 0
- local DriveSide = 'n'
- local RedstoneSide = 'top'
- local ActiveTicks = 2
- GetSecurityCode()
- GetAccountDetails()
- if DriveSide == 'n' then
- print("Couldnt Find Disk Drive")
- os.sleep(5)
- os.shutdown()
- end
- local Drive = peripheral.wrap(DriveSide)
- repeat until Drive.isPresent() == true
- if Drive.hasMountPath(".Secure_BankingScript") == false then
- os.sleep(5)
- os.reboot()
- local FilePath = Drive.getMountPath(".Secure_BankingScript")
- shell.run(FilePath,TransferMethod,Amount,SecurityCode,os.getID)
- if Drive.hasMountPath(ID.."_"..TransferMethod.."-Successful") == true then
- UpdateAccount()
- redstone.setOutput(RedstoneSide,1)
- os.sleep(ActiveTicks)
- redstone.setOutput(RedstoneSide,0)
- elseif Drive.hasMountPath(ID.."_"..TransferMethod.."-Failed") == true then
- fs.delete(".Secure_SecurityCode")
- fs.delete(".Secure_Account")
- end
- os.sleep(5)
- os.reboot()
- local function GetSecurityCode()
- local file = fs.open(".Secure_SecurityCode","r")
- SecurityCode = file.readAll()
- file.close()
- end
- local function GetAccountDetails()
- local file = fs.open(".Secure_Account","r")
- AccountName = file.readLine()
- AccountID = file.readLine()
- AccountBalance = file.readLine()
- AccountProtocol = file.readLine()
- AccountKey = file.readLine()
- file.close()
- end
- local function UpdateAccount()
- if TransferMethod == "Withdraw" then
- AccountBalance = AccountBalance + Amount
- elseif TransferMethod == "Deposit" then
- AccountBalance = AccountBalance - Amount
- end
- local file = fs.open(".Secure_Account","w")
- file.clear()
- file.writeLine(AccountName)
- file.writeLine(AccountID)
- file.writeLine(AccountBalance)
- file.writeLine(AccountProtocol)
- file.writeLine(AccountKey)
- file.close()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement