ESXserver
xPlayer.addMoney
ESX server documentation with a FiveM Lua example.
Summary
Adds money to an ESX player's primary account (usually cash/money). For bank use addAccountMoney('bank', amount).
Returns
void
Parameters
amountnumberHow much to add.Example
local xPlayer = ESX.GetPlayerFromId(src)
if xPlayer then
xPlayer.addMoney(500)
-- bank:
xPlayer.addAccountMoney('bank', 500)
endCommon pitfalls
- addMoney affects the main money account; use addAccountMoney for bank/black_money.
- Do it server-side on a validated xPlayer only.
Related functions
Related guides
FiveM scripts done right
Optimized, dual-framework scripts for QBCore and ESX from Viper Development — escrow protected, delivered instantly to your Cfx portal.
Browse Scripts →