np_vehiclehandler
OneSync vehicle lifecycle for the np_* resources. Use a stable ID, let the server manage the networked entity, and opt into streamed world parking when vehicles should return after a restart.
- Runtime
- FiveM OneSync
- Database
- oxmysql required by the manifest; saving records is opt-in
- Vehicle identity
- Stable string ID with plate and network aliases
- Optional integrations
- np_mechanic, np_fuel, vehicle keys and baseevents
- UI
- None
exports.np_vehiclehandler:registerPersistent('fleet:unit-12', {
model = 'police',
coords = vector4(452.1, -980.0, 25.7, 90.0),
bucket = 0,
streamed = true,
props = { plate = 'UNIT12' },
metadata = { unit = 12 },
})Persistent records keep their saved data when the entity streams out. Only create a record for a vehicle that should exist in the world; stored garage vehicles belong in the garage's own records.
One handler for shared vehicles
Vehicle identity and world lifecycle live in one place. Persistence is explicit, tuning data is bounded, and optional framework resources remain optional.
Server-owned lifecycle
Create and resolve managed vehicles by stable IDs, then update or remove their records through exports.
Spatial parking
Stream persistent world vehicles near players in the matching routing bucket. The database record stays while its entity is away.
Restart recovery
Opt-in oxmysql persistence restores eligible records and their saved identity, transform and vehicle data.
Tuning snapshots
Capture supported properties from the current network owner with a short-lived token and bounded payload.
Behavior hooks
Apply client-native handling and vehicle behavior, plus local preview, seat and NPC driver helpers.
Optional bridges
Connect tuning, fuel and key resources when present. The handler does not require a framework garage or key system.
Choose the lifecycle you need
Transient
Use spawn(opts) for a server-created vehicle that is not meant to be restored from persistent storage.
Streamed and persistent
Use registerStreamed(id, def) for parked world vehicles created near players and removed when nobody is nearby.
Persistent entity
Use registerPersistent(id, def) with streamed = false when the record should retain an active entity.

Install and integrate
Setup, configuration, persistence, tuning and exports are documented.