The Banking component manages player bank accounts, balance operations, and transaction history. It supports personal checking, savings, and organization accounts.
Overview
Access via Banking (server-side only).
Account Types Personal, Savings, Organization
Balance Operations Deposit, Withdraw, Charge
Transaction Logs Full transaction history per account
Joint Accounts Savings accounts with joint owners
Server-Side Only: All banking operations must be performed on the server. Never attempt to modify balances from the client.
Account Management
Banking.Accounts:Get
Get an account by its account number.
Banking . Accounts : Get ( accountNumber )
Account data or nil if not found
Example:
local account = Banking . Accounts : Get ( "1234567890" )
if account then
print ( 'Account:' , account . Account )
print ( 'Balance:' , account . Balance )
print ( 'Type:' , account . Type )
end
Banking.Accounts:CreatePersonal
Creates or retrieves an existing personal checking account for a character. New accounts start with $5,000.
Banking . Accounts : CreatePersonal ( ownerSID )
The personal checking account data
Example:
-- During character creation
AddEventHandler ( 'mythic-characters:server:CharacterCreated' , function ( source , character )
local account = Banking . Accounts : CreatePersonal ( character . SID )
Logger : Info ( 'Finance' , 'Personal account created' , {
console = true ,
file = true
}, {
character = character . SID ,
account = account . Account
})
end )
Banking.Accounts:GetPersonal
Retrieves an existing personal checking account.
Banking . Accounts : GetPersonal ( ownerSID )
Personal account or nil if none exists
Example:
local player = Fetch : Source ( source )
local char = player : GetData ( 'Character' )
local stateId = char : GetData ( 'SID' )
local account = Banking . Accounts : GetPersonal ( stateId )
if account then
print ( 'Balance: $' .. account . Balance )
end
Banking.Accounts:CreatePersonalSavings
Creates a personal savings account with optional joint owners.
Banking . Accounts : CreatePersonalSavings ( ownerSID , jointOwners )
Array of State IDs for joint owners
Example:
-- Create savings with a joint owner
local savings = Banking . Accounts : CreatePersonalSavings ( char : GetData ( 'SID' ), { partnerSID })
Banking.Accounts:GetPersonalSavings
Gets all savings accounts a character owns or has joint access to.
Banking . Accounts : GetPersonalSavings ( SID )
Array of savings accounts (owned and joint)
Banking.Accounts:AddPersonalSavingsJointOwner
Adds a joint owner to a savings account.
Banking . Accounts : AddPersonalSavingsJointOwner ( accountId , jointOwnerSID )
State ID of the new joint owner
Banking.Accounts:RemovePersonalSavingsJointOwner
Removes a joint owner from a savings account.
Banking . Accounts : RemovePersonalSavingsJointOwner ( accountId , jointOwnerSID )
Banking.Accounts:CreateOrganization
Creates an organization (business/government) bank account.
Banking . Accounts : CreateOrganization ( accountId , accountName , startingBalance , jobAccess )
Display name for the account
Array of job access definitions
Example:
-- Create police department account with default permissions
Banking . Accounts : CreateOrganization ( 'police-lspd' , 'LSPD Account' , 100000 , {
{
Job = 'police' ,
Workplace = 'lspd' ,
Permissions = {
MANAGE = 'BANK_ACCOUNT_MANAGE' ,
WITHDRAW = 'BANK_ACCOUNT_WITHDRAW' ,
DEPOSIT = 'BANK_ACCOUNT_DEPOSIT' ,
TRANSACTIONS = 'BANK_ACCOUNT_TRANSACTIONS' ,
BILL = 'BANK_ACCOUNT_BILL' ,
BALANCE = 'BANK_ACCOUNT_BALANCE' ,
}
}
})
Permission values are job permission strings (not grade numbers). The system checks if the player’s job has the specified permission via Jobs.Permissions:HasJob. Use strings like 'BANK_ACCOUNT_WITHDRAW' which map to job permission definitions.
Banking.Accounts:GetOrganization
Retrieves an organization account.
Banking . Accounts : GetOrganization ( accountId )
Banking.Accounts:AddOrganizationAccessingJob
Adds job access to an existing organization account.
Banking . Accounts : AddOrganizationAccessingJob ( job , workplace , permissionSettings )
Banking.Accounts:RemoveOrganizationAccessingJob
Removes job access from an organization account.
Banking . Accounts : RemoveOrganizationAccessingJob ( job , workplace )
Balance Operations
Banking.Balance:Get
Get the current balance of an account.
Banking . Balance : Get ( accountNumber )
Example:
local balance = Banking . Balance : Get ( "1234567890" )
print ( 'Current balance: $' .. balance )
Banking.Balance:Has
Check if an account has sufficient funds.
Banking . Balance : Has ( accountNumber , amount )
true if balance >= amount
Example:
if Banking . Balance : Has ( account . Account , 5000 ) then
-- Player can afford it
else
TriggerClientEvent ( 'mythic-notifications:client:Send' , source , {
message = 'Insufficient funds' ,
type = 'error'
})
end
Banking.Balance:Deposit
Deposit funds into an account.
Banking . Balance : Deposit ( accountNumber , amount , transactionLog , skipPhoneNoti )
Transaction log entry (see Transaction Log Structure below)
Skip sending phone notification
Updated balance after deposit
Example:
local player = Fetch : Source ( source )
local char = player : GetData ( 'Character' )
local account = Banking . Accounts : GetPersonal ( char : GetData ( 'SID' ))
local newBalance = Banking . Balance : Deposit ( account . Account , 5000 , {
type = 'deposit' ,
title = 'Paycheck' ,
description = 'Weekly salary payment' ,
transactionAccount = false ,
data = {}
})
Banking.Balance:Withdraw
Withdraw funds from an account.
Banking . Balance : Withdraw ( accountNumber , amount , transactionLog )
Updated balance after withdrawal
Withdraw does NOT check if the account has sufficient funds. Use Charge if you need automatic validation, or check with Has first.
Banking.Balance:Charge
Withdraw funds only if the account has sufficient balance.
Banking . Balance : Charge ( accountNumber , amount , transactionLog )
New balance if successful, false if insufficient funds
Example:
local result = Banking . Balance : Charge ( account . Account , 2500 , {
type = 'withdraw' ,
title = 'Vehicle Purchase' ,
description = 'Bought Elegy RH8' ,
transactionAccount = false ,
data = { vehicle = 'elegy' }
})
if result then
-- Purchase successful, new balance = result
TriggerClientEvent ( 'mythic-notifications:client:Send' , source , {
message = 'Purchase successful! Balance: $' .. result ,
type = 'success'
})
else
TriggerClientEvent ( 'mythic-notifications:client:Send' , source , {
message = 'Insufficient funds' ,
type = 'error'
})
end
Transaction Logs
Banking.TransactionLogs:Add
Record a transaction in the account’s history.
Banking . TransactionLogs : Add ( accountNumber , type , amount , title , description , transactionAccount , data )
Transaction type: deposit, withdraw, transfer, paycheck, fine, fine_profit, bill, loan
Related account number, or false if none
Banking.TransactionLogs:Get
Get transaction history for an account.
Banking . TransactionLogs : Get ( accountNumber )
Array of transaction records for the account
Transaction Log Structure
{
type = "deposit" , -- Transaction type
title = "Paycheck" , -- Display title
description = "Weekly salary" , -- Details
transactionAccount = false , -- Related account or false
data = {} -- Custom metadata
}
Transaction Types:
Type Description depositFunds deposited withdrawFunds withdrawn transferFunds transferred between accounts paycheckSalary payment fineGovernment fine fine_profitFine revenue share billBill payment loanLoan payment
Account Data Structure
{
Account = "1234567890" , -- Account number
Name = "Personal Account" , -- Display name
Type = "personal" , -- Account type
Owner = 123 , -- Owner SID
Balance = 5000 , -- Current balance
JointOwners = {}, -- Joint owner SIDs (savings only)
JobAccess = {} -- Job access rules (org only)
}
Best Practices
Always Use Charge for Purchases
-- ✅ Good: Charge checks balance automatically
local result = Banking . Balance : Charge ( account . Account , price , {
type = 'withdraw' ,
title = 'Shop Purchase' ,
description = itemName ,
transactionAccount = false ,
data = {}
})
if not result then
return -- Insufficient funds
end
-- ❌ Bad: Withdraw without checking
Banking . Balance : Withdraw ( account . Account , price , transactionLog )
-- Always provide meaningful transaction logs
Banking . Balance : Deposit ( account . Account , amount , {
type = 'deposit' ,
title = 'Job Payment' ,
description = string.format ( 'Payment for %s work' , jobLabel ),
transactionAccount = false ,
data = {
job = jobName ,
hours = hoursWorked
}
})
local player = Fetch : Source ( source )
if not player then return end
local char = player : GetData ( 'Character' )
if not char then return end
local account = Banking . Accounts : GetPersonal ( char : GetData ( 'SID' ))
if not account then return end
-- Safe to use account
Next Steps
Finance - Payments Cash, bills, fines, and charges
Finance - Crypto Cryptocurrency system
Finance - Loans Loan and credit system
Characters API Character data access