Money Tracking
FiniAC reads player balances from ESX and QBCore on its own. Any other framework can report balances with the FiniAC:UpdatePlayerMoney event, which feeds the same data: the per-character money history on the panel and the SusMoney detection.
FiniAC:UpdatePlayerMoney Event
Trigger this event on the server right after your framework writes a balance.
Parameters:
source(number or string): The player's server IDcharacter(any): Identifies the character the balance belongs to. Each distinct value gets its own history on the panel. Use your character ID, a name, or any constant such as1if your framework has one character per player.nilrecords the history without a character.account(string):"cash"or"bank". Any other account name is ignored, so you can call the event from a generic set-money function without filtering.amount(number): The player's new balance for that account, not the amount that changed
What happens:
- The balance is stored as a point in the money history
- A jump larger than the
SusMoneyLimitsetting raises aSusMoneydetection
Usage Examples
lua
-- Inside your framework's server-side money setter
function Player:SetMoney(account, amount)
self.money[account] = amount
-- ... your own persistence ...
TriggerEvent("FiniAC:UpdatePlayerMoney", self.source, self.characterId, account, amount)
endtypescript
// Inside your framework's server-side money setter
function setMoney(
source: number,
characterId: string,
account: "cash" | "bank",
amount: number,
): void {
players[source].money[account] = amount;
// ... your own persistence ...
emit("FiniAC:UpdatePlayerMoney", source, characterId, account, amount);
}Best Practices
TIP
- Trigger the event from the one place your framework writes balances, so every change is reported
- Send the new balance, never the difference
- Keep the
charactervalue stable for the whole session. A new value starts a new history and resets theSusMoneybaseline