Balance changes
- Added
- Updated
addMoney and removeMoney take a positive whole-number amount.
setMoney takes the new whole-number balance, including zero; a negative result still requires allowNegative = true.
Unknown accounts, unloaded characters, insufficient funds, or a rejection by handler:canChangeMoney return false.
Use reason to identify why a balance changed; an omitted reason becomes @<calling resource>.
local accepted = exports.REC_Core:removeMoney(playerId, "bank", 250, "vehicle-repair")
if accepted == false then
return
end
Check the return value before completing the associated purchase or reward.
Online changes update server memory, synchronize the owner’s client, and emit onMoneyChange; database persistence follows the configured save mode.
addOfflineMoney and removeOfflineMoney write directly to the database and reject characters that are currently loaded.
They emit onOfflineMoneyChange after a successful write.
