Installation ​
np_legal targets FiveM cerulean, Lua 5.4, ESX, np_inventory, and oxmysql. QB/QBX identity lookup is included as
a compatibility fallback. Install the schema once (or let the resource run its idempotent installer), then ensure
dependencies before np_legal:
ensure oxmysql
ensure es_extended
ensure np_inventory
ensure np_faction
ensure np_jobs
ensure np_payments
ensure np_prison
ensure np_legal
np_admin (through the vendored library), np_faction, np_jobs, and the listed integration resources are optional at boot. np_jobs is an
optional capability host because np_legal's service should still start when it is absent. If np_jobs exists but
is stopped or restarting, legal feature actions fail closed. Without it, add your server's feature mapping to
config/fallback_jobs.lua; job names and grade cutoffs belong only in that file. Fallback mode cannot perform the
host's certification, grant-provider, or job editor validation.
The schema installer reads sql/install.sql on start; review that file and your DB backup policy before the first
production start. For a manual install, import it with oxmysql's supported SQL client. All records use the np_legal_
prefix. Event history is append-only through this resource API; do not grant client SQL access.
Existing installations should apply each numbered SQL file in sql/migrations/ once before updating the resource.
Migrations 004_warrant_execution_claim.sql and 005_warrant_execution_started_at.sql add claim data for warrant execution; 013_warrant_execution_action.sql records the action requiring manual reconciliation; 014_warrant_reconciliation_audit.sql adds a separate reconciliation audit without replacing the original signer and decision note. Apply 014 even when 013 was already applied before this version. The resource checks for all required warrant columns and does not announce readiness if they are missing. A denial is also claimed before calling its provider, so an interrupted denial is quarantined and can be explicitly resolved. For older reconcile_required approvals where the action is unknown, staff must choose the action after inspecting the provider record; the resolver records that choice conditionally. Staff with np_legal.override inspect provider state and explicitly resolve whether the action applied. Migration 006_bail_posting_recovery_claim.sql adds a compare-and-swap claim for interrupted bail posting recovery; 007_bail_payment_attempt_correlation.sql stores a distinct correlation for every posting attempt and backfills the legacy correlation on in-progress rows; 008_bail_release_confirmation.sql records confirmed prison releases; 009_bail_release_attempt_marker.sql persists the attempt before calling the prison API and marks legacy in-progress rows as attempted; 010_bail_sentence_identity.sql stores the legacy custody signature; 011_bail_refund_attempt_marker.sql prevents retrying an ambiguous np_payments refund; and 012_booking_id_and_refund_reconciliation.sql quarantines active bail rows created before booking IDs were available. Ambiguous legacy or crash-window release/refund states and changed custody remain for manual reconciliation, rather than risking release from a later sentence or issuing a duplicate refund. Migrations 005 and 006 backfill timestamps for older in-progress rows.
For recovery of a committed charge whose export call was interrupted before np_legal saved the reference, use an np_payments version with the caller-scoped FindPaymentByCorrelation(correlation) export. It scopes lookups to the calling resource, so np_legal does not pass a resource name.
For bail release, np_prison must expose GetSentence().bookingId and accept expectedBookingId in UnjailPlayer; np_legal fails closed if those are absent. Bail refund recovery records the refund attempt before calling np_payments. Definitive no-movement errors such as payee_funds clear the attempt marker so an authorized retry can proceed; partial or crash-ambiguous refunds require reconciliation and are never automatically retried. A Charge result of reconciliation_required is saved against the bail and keeps it in posting recovery until the payment ledger is reconciled; it is never charged again.
Documents are registered dynamically through np_inventory:RegisterItem. That means legal papers are unavailable
until np_inventory is started. If using a static item catalogue or another inventory, register the legal_document
item there and implement the inventory bridge; database records remain authoritative.
Permissions and job features ​
There is no ACE permission path. Job gameplay uses server-side hasFeature checks through the vendored
bridge/np_jobs.lua adapter; administrative exceptions use the vendored lib/np_admin.lua. Configure the nodes and
feature membership in np_faction / np_jobs. The fallback map example:
return {
justice = {
['legal.judge'] = { minGrade = 2 },
['legal.warrant_sign'] = { minGrade = 1, config = { kinds = { 'search', 'arrest' } } },
['legal.records'] = { minGrade = 1 },
},
counsel = {
['legal.represent'] = { minGrade = 0 },
},
}
Replace these job identifiers with your ESX job names. Feature ids and configs are declared in
shared/features.lua. Never add permissions based on a client event, job name, or ACE.
Order and compatibility ​
The resource auto-detects np_inventory, np_payments, np_prison, np_identification, np_housing,
np_dealership, and np_screens only when each is started. Effects requiring an absent provider return an error and
remain visible in the ruling record. The court and public docket can still run without those integrations.
np_dealership vehicle title flows are signature-gated: the registered transfer is committed only after seller,
buyer, and assigned notary have each signed. No property transfer provider is registered because the current
np_housing checkout has no runtime ownership API; register one only after housing publishes a verified contract.
The police warrant provider mirrors approval, denial, revocation, and the legal expiry to np_police records. The
current np_surveillance runtime registers a named legal warrant provider and sends its requests to np_legal while
legal is started. Approval, denial, and revocation are mirrored to surveillance records; tap and tracker coverage
follows those records and their expiry. Local judge decisions are blocked for requests owned by np_legal. When
legal is absent, surveillance keeps its local decision flow.
Lawyer visits use the np_legal-restricted np_prison:BookLawyerVisit(source, inmateIdentifier, at?) export;
np_legal checks legal.represent first, and prison still enforces custody, configured lawyer rooms, and slot rules.
Without np_prison the request returns prison_unavailable.