legacy-scoreboard
Integration
Exports and events for integrating with legacy-scoreboard.
Integration
legacy-scoreboard exposes two server-side exports, both registered as ox_lib callbacks, plus two standard FiveM events used internally.
legacy-scoreboard:getData
- Side: server (registered
server/server.lua:31) - Signature:
(src) -> table|nil
Returns the scoreboard payload for the requesting player: players list, services, activities, maxPlayers, localId, keybind label, and branding (logo/accent). Returns nil if the caller is within Config.RefreshCooldownMs of their last request.
Call it from the client using ox_lib's callback await:
-- client/client.lua (or your own client script)
local data = lib.callback.await('legacy-scoreboard:getData', false)
if data then
-- data.players, data.services, data.activities, data.maxPlayers, data.localId, data.keybind
end
legacy-scoreboard:setAnonymous
- Side: server (registered
server/server.lua:104) - Signature:
(src, anon) -> { ok = boolean, anon = boolean }
Sets the calling player's anonymity flag and persists it via SetResourceKvpInt, keyed by the player's citizenid. Returns { ok = false } if the player's Framework identifier could not be resolved.
Called from the NUI via the setAnonymous NUI callback, which the client relays. To trigger it yourself from client-side Lua:
-- client/client.lua (or your own client script)
local result = lib.callback.await('legacy-scoreboard:setAnonymous', false, true) -- true = go anonymous
if result.ok then
print('Anonymous is now:', result.anon)
end
Events
onResourceStop
- Direction: server-to-client (standard FiveM event)
- Handled in:
client/client.lua:40
When legacy-scoreboard itself stops while the board is open, this handler immediately releases NUI focus (SetNuiFocus(false, false)) and sends { action = 'close' } to the NUI, bypassing the normal close animation. This is a safety fallback only — you don't need to fire this yourself.
playerDropped
- Direction: server-side (standard FiveM event)
- Handled in:
server/server.lua:111
Clears the dropped player's entry from the internal lastRequest cooldown table. No action needed from integrators; this runs automatically.