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.
| Arg | Type | |
|---|---|---|
target | number | string | player server id, or an identifier (scores an offline character) |
board | string | a money board key |
amount | number | positive; floored; above Capture.max is refused |
opts.reason | string? | passed to the beforeScore hook |
opts.name | string? | 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.
-- 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.
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.
| Hook | Cancellable | Payload | Use |
|---|---|---|---|
beforeScore | yes, mutable amount | source, identifier, board, amount, reason | weekend multipliers, exclude jobs |
beforeAward | yes, mutable label | period, board, rank, identifier, kind, label | rename or skip rewards |
afterAward | no | same as above | give your own cosmetic (a tag, a badge) |
monthClosed | no | period, board, label, given, podium | announce winners in game |
rewardRequested | no | source, identifier, id, kind, label, request | automate plates/outfits, then FulfilAward(id) |
titleChanged | no | source, identifier, title (nil when cleared) | update a nametag |
-- 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:
local t = LocalPlayer.state.ccBoardsTitle -- { label = 'No. 1 Anglers · Jan 2027', board = 'fishing' } or nil
local other = Player(serverId).state.ccBoardsTitleIt 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):
| Event | Arguments | Server checks |
|---|---|---|
cc_boards:title:set | award id (0 = none) | the award is the caller's, a title, not revoked |
cc_boards:reward:request | award 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.