How to Build a Banking & Economy Script for a GTA Roleplay Server With AI
Money is the engine of a roleplay server. A banking and economy script decides where money lives (cash on hand vs. bank balance), how it moves (deposits, withdrawals, transfers, bills), and how it is created or destroyed (paychecks in, taxes and fees out). Get the design right and your server has tension and progression; get it wrong and inflation makes every job and heist meaningless.
This guide covers building a bank around the account system your framework already provides cash, bank, and often a 'dirty money' account for illicit cash. You will add ATMs, a bank UI, transfers, and bills, all validated on the server so balances can't be forged. PlayDeck teaches you to build this with AI: you describe the accounts, fees, and UI you want, steer the AI as it writes the oxmysql-backed Lua and NUI, then test it before selling it on Tebex.
Understand the account model first
Before writing anything, decide how money is modeled. QBCore stores money as a table on the player (cash, bank, and crypto) and persists it in the players row; you move it with Player.Functions.AddMoney('bank', amount, reason) and RemoveMoney. ESX uses accounts (money/cash, bank, black_money) accessed via xPlayer.addAccountMoney('bank', amount) and getAccount. QBox mirrors QBCore.
The 'dirty' or 'black' money account is what makes crime meaningful: heists and drug sales pay dirty cash that can't be deposited until it's laundered. If you want laundering, design where it happens (a launderer NPC, a business) and the cut the player loses. Decide this model up front, because every other feature ATMs, transfers, bills just reads and writes these accounts.
Build ATMs and the bank UI
ATMs are interaction points. Place ox_target zones on the ATM prop models (and bank teller peds), and on interaction open your NUI bank interface. The UI is HTML/CSS/JS rendered through FiveM's NUI layer; it shows the balance, and posts deposit/withdraw/transfer requests back to Lua via fetch to a registered NUI callback.
The non-negotiable rule: the UI is display only. When the player clicks 'withdraw 500,' the client sends the request, but the server re-reads the real balance, verifies the player is actually near an ATM, checks they have the funds, and only then moves the money and tells the client the new balance. Never let the client send the new balance that is how forged-money exploits happen on amateur servers. Persist every change through oxmysql so balances survive a restart.
Add transfers, bills, and society accounts
Player-to-player transfers move bank money from one citizen to another by their account/state ID, with a server check that the sender has the funds and the recipient exists. Bills (invoices) let a business or officer charge a player; the target gets a notification and pays from cash or bank, crediting the issuer's society account. Society accounts (QBCore's qb-management, ESX's esx_society) hold company money separately from any individual so a business economy is auditable.
Add small, consistent fees an ATM withdrawal fee, a transfer fee, a tax on paychecks as money sinks. Without sinks, money only ever enters the economy and prices spiral. When you steer an AI to build this, tell it the exact fee percentages and which account each fee drains to; the AI handles the arithmetic and persistence, you verify the server-side balance checks and that nothing trusts a client-sent amount.
Balance the economy and prevent exploits
An economy is a system of inflows (paychecks, job payouts, heists) and outflows (purchases, fees, repairs, fines). List every inflow and outflow on your server and make sure outflows are real. A healthy GTA RP economy keeps starting players poor enough that jobs matter and rich players spending enough that money leaves circulation.
Security checklist for any money code: validate amounts are positive integers server-side, re-check balances before debiting, rate-limit transactions to stop spam, log every transaction with a reason string, and never expose a NUI callback that sets a balance directly. Following the Cfx.re rules also matters commercially you monetize the finished script on Tebex with a Cfx.re license and escrow, never by leaking or reselling someone else's bank script.
Frequently asked questions
Should heists pay clean or dirty money?
Dirty (black) money. Paying clean cash from crime removes all risk and floods the economy. Dirty money forces players to launder at a cut, which is both a money sink and a roleplay opportunity.
How do I stop money duplication exploits?
Keep balances authoritative on the server, validate every amount as a positive integer, re-check funds before every debit, and never accept a new balance from a NUI callback. Persist changes through oxmysql immediately.
Do I need to build my own bank or use an existing one?
Many servers extend qb-banking or an ESX bank rather than start from zero. Building your own teaches you the account model and lets you add custom features like loans or laundering and gives you something original to sell on Tebex.
What are money sinks and why do they matter?
Money sinks are outflows that destroy currency fees, taxes, repairs, fines. They counter the inflation from paychecks and payouts. A server with strong inflows and weak sinks becomes a place where money is worthless.
Can AI build a banking UI too?
Yes. You describe the screens (balance, deposit, withdraw, transfer, transaction history), and the AI writes the NUI HTML/CSS/JS plus the Lua callbacks. You steer the design and, crucially, verify the server-side validation. PlayDeck walks you through exactly that.