🤠 Wild Country Libs
Server API

Money

Reads and writes are kept separate on purpose — GetMoney never mutates, AddMoney never returns a balance. One named function per currency, no overloaded type parameter to remember.

GetMoney(source)server

Cash balance only.

ParamTypeReturns
sourceintegernumber | nil
example
local cash = wc:GetMoney(source)
if cash >= price then
  wc:RemoveMoney(source, price)
end
GetBankMoney(source)server

Bank balance.

VORP has no native bank currency. VORP only has money / gold / rol — there's no separate bank balance in the docs this lib was built against. Calling GetBankMoney on a VORP server prints a console warning and returns nil. On RSG it returns PlayerData.money.bank as expected.
GetGold(source)server

Gold balance.

RSG has no native gold currency. Calling GetGold on RSG warns and returns 0, unless you've pointed WCLibConfig.Money.rsg.gold at a custom money-type key your server defines. On VORP it returns the character's actual gold balance.
wc_libs/shared/config.lua
WCLibConfig.Money.rsg.gold = 'gold' -- if your server defines this money type
AddMoney(source, amount, currencyType?)server

Adds cash by default. Pass currencyType to target a specific VORP currency index or RSG money key.

ParamTypeDescription
sourceintegerThe player's server ID.
amountnumberAmount to add.
currencyTypenumber | string | nilOptional override — VORP index (0/1/2) or RSG money key.
underneath, on —
vorp_core
character.addCurrency(0, amount) -- 0 = cash, 1 = gold, 2 = rol
rsg-core
Player.Functions.AddMoney('cash', amount)
example — reward payout
wc:AddMoney(source, 50)
wc:Notify(source, { title = "+$50" })
RemoveMoney(source, amount, currencyType?)server

Removes cash by default. Same currencyType override as AddMoney.

example — shop purchase
local cash = wc:GetMoney(source)
if cash < price then
  wc:Notify(source, { variant = 'fail', title = "Not enough cash" })
  return
end
wc:RemoveMoney(source, price)

Real Wild County example — stagecoach mission payout

wc_stagecoach pays the driver once a delivery run completes, after re-checking the mission is still marked active server-side (never trusting a client "I'm done" event alone).

wc_stagecoach/server/main.lua
RegisterNetEvent('wc_stagecoach:missionComplete', function()
  local src = source
  if not ActiveRuns[src] then return end -- server never started a run for this player

  local reward = ActiveRuns[src].reward or 50
  ActiveRuns[src] = nil

  wc:AddMoney(src, reward, 0)
  wc:Notify(src, { title = ("Stagecoach Complete: +$%d"):format(reward), variant = 'avanced' })
end)

Common mistakes

Security notes

Security. Never let the client tell the server how much a reward, refund, or purchase costs. Compute prices from server-side config/database, validate the player can afford it with GetMoney before calling RemoveMoney, and only call AddMoney after the corresponding action (item removed, mission verified, etc.) has actually happened server-side.

Troubleshooting