Skip to content

Integrations ​

The handler can run without framework, fuel, tuning or keys resources. Integrations are detected at runtime and should fail safely if an optional resource is stopped.

Resource Integration
oxmysql Required by the resource manifest. The SQL schema is needed when you register persistent records.
np_mechanic Resolves real plates through GetRealPlate, enriches captured properties through GetVehicle, and replicates its tuning state bag (default npmVeh).
np_fuel Optional fuel property write when applying a snapshot; reads use the game vehicle native.
np_vehiclekeys Optional GiveKey(src, vehicleOrPlate) and RemoveKeys(src, vehicleOrPlate) grant/revoke integration, plus CanAccess(src, vehicleOrPlate, 'drive') server engine authorization.
qb-vehiclekeys / qbx_vehiclekeys Optional client key grant event fallbacks.
baseevents Optional driver-exit signal used to request a fresh tuning snapshot; a local player vehicle watcher provides a fallback.
np_npchandler Optional server-ticketed networked NPC driver path; local-only fallback is used when absent.
VehicleDeformation Optional client adapter for collecting and restoring vehicle deformation. Override its resource name with Config.Integrations.vehicleDeformationResource.

The handler protects optional export calls and checks resource state. np_mechanic client state bag name defaults to npmVeh and can be changed with Config.Integrations.mechanicStateBag. Config.Integrations.serverEngineCheck defaults to true; setting it to false disables the handler's server authorization check on the client.

Authorization boundary ​

The handler owns the networked entity lifecycle and validates snapshot ownership. Your garage, dealership, mechanic and keys resources still own game rules: check vehicle ownership before moving or removing a record, validate parts and payment before calling setProps, and grant or revoke credentials through the approved server API. With np_vehiclekeys started, canStartEngine uses its synchronous CanAccess result and fails closed on denial or lookup errors. Without a key resource or registered server veto, authorization defaults to allowed. The server registerEngineVeto export adds application-specific denials. The client's CanStartEngine result is useful for controls, while server resources should continue enforcing their own transactions and permissions.

Integration example ​

lua
if GetResourceState('np_vehiclehandler') == 'started' then
  local ok, reason = exports.np_vehiclehandler:setProps(vehicleId, updatedProps)
  if not ok then
    print(('Could not update vehicle %s: %s'):format(vehicleId, reason))
  end
end

See Compatibility and migration for moving existing vehicle creation code.