legacy-scoreboard
Overview
What legacy-scoreboard does and how it fits together.
legacy-scoreboard
legacy-scoreboard is a FiveM scoreboard resource built for Bayview. It shows:
- Online players (with optional anonymity)
- On-duty headcounts for configured city services (e.g. police, EMS, mechanic)
- A list of activities (e.g. heists) whose availability is gated by how many cops are currently on duty
Architecture
- Client (
client/client.lua) — registers a keybind (via ox_lib) to open the board, manages NUI focus, and handles NUI callbacks (close,setAnonymous). It requests data from the server vialib.callback.await('legacy-scoreboard:getData', false). - Server (
server/server.lua) — builds the scoreboard payload (players, services, activities, branding), enforces per-player anonymity server-side, persists the anonymity choice via resource KVP keyed by citizenid, and rate-limits refresh requests per player. - NUI (
web/) — a React/Vite/Tailwind app that renders the board and postscloseandsetAnonymouscallbacks back to the client.
Dependencies
This resource depends on:
- legacy-lib — supplies the Framework wrapper (
Framework()), the framework-admin check used for staff badges, and branding exports (GetLogo,GetAccentColor,GetAccentGradient). - ox_lib — supplies
lib.callback(both server callbacks),lib.addKeybind(client keybind registration), andlib.callback.await(client-side request).
Both must be running before legacy-scoreboard starts — see Installation for details.