Admin & security ​
Permissions resolve through npAdmin.can, configured FiveM identifiers, framework groups and optional cached Discord roles. There is no ACE fallback.
| Node | Purpose |
|---|---|
np_racing.admin |
Staff dashboard and session moderation |
np_racing.creator.verify |
Verify/hide tracks |
np_racing.host.sanctioned |
Restricted sanctioned hosting |
np_racing.records |
Void records |
np_racing.flags |
Review anti-cheat flags |
np_racing.spectate.all |
Restricted spectating |
np_racing.debug |
Debug/calibration endpoints |
The vendored np_admin library lives at bridge/np_admin.lua. Settings are registered in shared/np_admin_settings.lua; staff actions, logs and theme use np_admin when running.
Validation ​
Race authority remains on the server: gate order, position, plausible timing, event membership, fee collection, result validity and permission checks. RPC requests are allowlisted and rate/size bounded. Client timing, ghost frames and NUI values are advisory.
Anti-cheat flags provide an audit/review path. Holds and record decisions must be validated before settlement. Flags are evidence for staff review, not a claim that every possible FiveM cheat is prevented. Veto hook exceptions stop the action with hook_error.
Staff operations ​
Admin routes cover session listings/cancellation, watching, track verification, record voiding, flag review and profile/calibration operations. Exact method names and payloads live in the resource API and architecture contract. Flag review can replay stored multi-driver traces. Financial reconciliation is required if a provider deposit succeeds before a crash prevents SQL acknowledgement; durable intent rows alone do not prove exactly-once delivery. Pink-slip reversal is unavailable without an actual ownership provider.

Cancellation and refund recovery ​
Before a live start, cancellation persists cancel_pending before recording per-escrow refund intents. A database failure retains membership and the pending cancellation for retry; joins/start/settings remain blocked. The server retries pending cancellations every 15 seconds, and login recovery reconstructs missing refund intents from persisted held escrow. Leave/kick also keep membership and the pot if an intent cannot be persisted.
Successful leave/cancel and released escrow mean the refund was delivered or durably recorded. Pending provider delivery still uses the reconnect outbox; refunded is an accepted obligation total, not a deposit receipt. Ambiguous deposits use the staff recovery contract below.
Startup marks stale persisted lobby/staging/countdown events cancel_pending and closes those with no held escrow; drivers recover remaining obligations on login. Resource stop attempts the same pre-start cancellation protocol. Pre-start unwind restores buckets, unfreezes/unlocks vehicles and removes session props before the marker write/read. A marker persistence failure leaves financial cancellation pending for retry without keeping racers physically staged. Stale live/results events are not automatically refunded by this sweep.
Settlement persistence ​
Settlement caches payout decisions and records authoritative result obligations plus each nonzero prize's unique held intent before applying profile/season effects. While the resource keeps the session in memory, per-driver/per-step progress tracks completed writes and retries failures. Rating/stat retries reapply immutable absolute profile targets, season rounds replace/deduplicate by event ID, and lap/replay writes look up existing rows before inserting. The event becomes settled/results only after required writes complete; physical race cleanup can already have completed. A paid intent can repair result/escrow metadata without another provider deposit.
After a restart, validated result rows with payment_status='pending' and a positive prize rebuild missing held prize intents on login, then use the normal flag review and payout claim flow. Prize obligations/results are durable; the settlement progress and profile targets are in memory, so complete rating/statistics recovery across a restart is not guaranteed. This uses the existing results/payout tables; no new settlement table is required.
Review flags are persisted by kind; a failed flag write keeps the result in review rather than approving it from an empty flag query. Held prize activation and delivery require an authoritative validated result with payment status pending/paid, and zero open or void flags. Reconnect releases only validated pending obligations through these same checks. Staff resolution compares every kind in the result's flags_json with durable flag rows; missing evidence returns review_pending. After all flags are cleared, staff approval must successfully persist result validation before activating/delivering the held prize. If that validation write fails, retrying the same already-cleared flag decision can finish approval; clearing a flag alone does not authorize payment.
Recover a payout after a crash ​
An interrupted provider call can leave a payout in paying; unfinished legacy rows migrated from the old payout key use reconciliation. Automatic reconnect retry excludes both ambiguous states. Staff with np_racing.flags use admin.payout.reconcile with {eventId, identifier, decision, intentKind?, intentKey?} after confirming the provider's outcome for that specific intent.
Omitting the optional fields selects prize / prize. A refund requires intentKind:'refund' and intentKey equal to the exact escrow row ID as a string. A migrated ambiguous record requires intentKind:'legacy', intentKey:'legacy'.
| Decision | Confirm first | Result |
|---|---|---|
paid |
Deposit was delivered | Marks the intent paid with no new deposit. Prize: marks the result paid and held event/driver escrow settled. Refund: releases only its exact held escrow row. Legacy: no guessed result/escrow changes. |
retry |
Deposit was not delivered | Changes the intent to failed with staff_confirmed_unpaid. Normal reconnect retry may deliver it later; this action makes no immediate deposit. |
Only paying or reconciliation rows can be reconciled. Success returns {eventId, identifier, status:'paid'|'failed'}. Missing rows return result_not_found; a different/concurrently changed state returns reconciliation_required. Other errors include permission_denied, invalid_args and database_error. See Exports & events for the full contract.
Operational verification ​
Test resource stop, player drop, cancellation and restart while a lobby/race is active. Check bucket and focus restoration, vehicle freeze/collision cleanup and refunded/held settlement states. Test staff access both with np_admin and with your configured fallback. See Development for automated checks and live-server limitations.