Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArg = {..}
- local AccountName = 'guest'
- local AccountID = 000000
- local PreBalance = 0
- local AccountBalance = 0
- local AccountProtocol = AccountID
- local AccountKey = 0000
- local SecurityCode = 00000
- GetAccountDetails()
- PreBalance = AccountBalance
- getSecurityCode()
- CheckTransfer()
- local function CheckTransfer()
- if tArg[2] == SecurityCode then
- if tArg[0] == "Deposit" then
- AccountBalance = AccountBalance + tArg[1]
- elseif tArg[0] == "Withdraw" then
- AccountBalance = AccountBalance - tArg[1]
- end
- WriteRecept("Successful")
- print("Transfer Successful")
- os.sleep(10)
- os.reboot()
- else
- print("Invalid Security Code")
- WriteRecept("Failed")
- os.sleep(4)
- os.shutdown()
- end
- end
- local function getSecurityCode()
- local file = fs.open(".Secure_SecurityCode","r")
- SecurityCode = fs.readAll()
- file.close()
- end
- local function WriteRecept(Result)
- local file = fs.open(tArg[3].."_"..tArg[0].."-"..Result)
- file.writeLine(tArg[0].."_"..tArg[1])
- file.writeLine(tArg[2])
- file.writeLine(PreBalance)
- file.writeLine(AccountBalance)
- file.close()
- print("Recept Printed")
- 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()
- 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