Skip to content

cc_boards exports, hooks and state

Everything here is server-side unless marked client. Identifiers are your framework's character id (QBCore/Qbox citizenid, ESX char1:..., ox_core charN, standalone license).

Everything here is server-side unless marked client. Identifiers are your framework's character id (QBCore/Qbox citizenid, ESX char1:..., ox_core charN, standalone license).

Server exports

AddScore(target, board, amount, opts?) -> boolean

Add to a money board, this month and all time.

ArgType
targetnumber | stringplayer server id, or an identifier (scores an offline character)
boardstringa money board key
amountnumberpositive; floored; above Capture.max is refused
opts.reasonstring?passed to the beforeScore hook
opts.namestring?display name when target is an identifier

Returns false for an unknown/hidden board, a non-money board, a bad amount, or a blocked hook.

lua
-- in your fishing script, where you pay the player
exports.cc_boards:AddScore(source, 'fishing', payout, { reason = 'my_fishing:sell' })

GetTop(board, period?, limit?) -> rows

period: 'YYYY-MM' or 'all' (default this month). limit 1-100 (default Config.Rows). Returns { { rank, name, score, identifier } }. For business boards identifier is the owner.

GetRank(identifier, board, period?) -> { rank, score } | nil

GetTitle(identifier) -> { label, board, period } | nil

The title a character currently wears.

GetAwards(identifier) -> list

{ { id, kind, label, board, period, rank, status } }, newest first, revoked ones left out. status: granted, requested, fulfilled.

GetBoards() -> list

Live boards: { { key, label, icon, unit, kind } }.

FulfilAward(id) -> boolean

Mark a plate/outfit award as set up (what /boardsadmin fulfil does).

RunAwards(period) -> integer

Give a finished month's rewards now. Idempotent. Normally automatic.

FlushScores() -> integer

Write pending scores now.

registerHook(name, fn, opts?) -> id, removeHook(id), getHooks()

See hooks below. Hooks registered from another resource are removed when it stops.

Client export

OpenBoards()

Opens the leaderboard menu, e.g. from a tablet app or a target zone.

lua
exports.cc_boards:OpenBoards()

Hooks

Register from your own resource (exports.cc_boards:registerHook(...)) or inside custom/server.lua (CC.hooks.register(...)). A hook can only narrow what cc_boards does: block it or change a value it then re-checks. Handlers run in pcall; a broken hook never breaks the resource.

HookCancellablePayloadUse
beforeScoreyes, mutable amountsource, identifier, board, amount, reasonweekend multipliers, exclude jobs
beforeAwardyes, mutable labelperiod, board, rank, identifier, kind, labelrename or skip rewards
afterAwardnosame as abovegive your own cosmetic (a tag, a badge)
monthClosednoperiod, board, label, given, podiumannounce winners in game
rewardRequestednosource, identifier, id, kind, label, requestautomate plates/outfits, then FulfilAward(id)
titleChangednosource, identifier, title (nil when cleared)update a nametag
lua
-- double fishing scores at weekends
exports.cc_boards:registerHook('beforeScore', function(p)
    local d = tonumber(os.date('%w'))
    if p.board == 'fishing' and (d == 0 or d == 6) then p.amount = p.amount * 2 end
end)

A changed amount is re-validated (whole, positive, under Capture.max).

State bag

The worn title is set on the player's state bag (key ServerConfig.StateBag, default ccBoardsTitle), replicated, so any HUD or nametag can read it on the client:

lua
local t = LocalPlayer.state.ccBoardsTitle      -- { label = 'No. 1 Anglers · Jan 2027', board = 'fishing' } or nil
local other = Player(serverId).state.ccBoardsTitle

It is set when the character loads and whenever they change title.

Net events (for reference)

Players can only trigger these, both through cc_lib's security gate (typed arguments, cooldown, one in flight):

EventArgumentsServer checks
cc_boards:title:setaward id (0 = none)the award is the caller's, a title, not revoked
cc_boards:reward:requestaward id, text (max 64)the award is the caller's, a plate/outfit, still granted; plate text against ServerConfig.Plate

Callbacks (reads only): cc_boards:boards, cc_boards:view, cc_boards:mine.