Tuning and vehicle properties ​
Vehicle property capture and application are handled by the client property module. It supports common ESX-style vehicle properties, mod indices and optional np_mechanic state (npmVeh). np_fuel integration is optional; neither resource is a hard dependency.
Seed properties at registration ​
Pass initial properties in the vehicle definition. These properties are applied when the entity is created and when a new entity generation is spawned after streaming or restart.
exports.np_vehiclehandler:registerPersistent('np_garage:car:3812', {
model = 'sultan',
coords = vector4(215.2, -810.3, 30.7, 158.0),
props = {
plate = 'NP3812',
modEngine = 3,
modTransmission = 2,
modTurbo = true,
color1 = 12,
color2 = 0,
fuelLevel = 62.0,
},
})
Use the same ID to update the handler's record with setProps after a server-authorized purchase or repair. Do not trust a client-provided price, ownership, or mod entitlement; validate those in the purchasing resource before calling the export.
Capture live changes ​
The client asks the server to mark a vehicle dirty when a player leaves it. There is no event for every native tuning change. Persistent active vehicles also receive periodic captures (Config.Snapshot.interval, 30 seconds by default); use the server captureSnapshot(id) export when an important transition needs an immediate capture. The server verifies the current network owner (or the allowed recent-driver path), rate limits dirty requests, issues a short-lived single-use token, then accepts the response only from that owner and for the same ID and generation. This protects against stale entity handles and unbounded snapshot payloads.
Snapshots may include npmVeh, the configured np_mechanic entity state bag, in the captured client properties. The server bridge can separately enrich accepted properties with npMechanic, a copied record from np_mechanic's GetVehicle(plate) export. Those fields have different sources. If your tuning resource stores authoritative data separately, keep its own persistence as the source of truth and update the handler record through server exports.
The latest successful database save is the restart recovery point. An abrupt server crash can lose tuning changes made since the last capture; use explicit captures and flushes around critical transitions when needed.
What this cannot guarantee ​
FiveM does not expose every vehicle value as a server-readable property. The handler relies on a constrained client snapshot for supported properties and requires live testing with your game build and tuning resources. Test modified components, custom colors, fuel state and ownership migration before production use.