For the complete documentation index, see llms.txt. This page is also available as Markdown.

compatibility

When Config.EnableCompatible = true (default), s4-wheeldamage automatically resets its internal damage state when external mechanic scripts repair a vehicle.

This prevents conflicts where a mechanic script fixes the vehicle visually but s4-wheeldamage still tracks broken wheels or active leaks.

How it works

Event listener

The script registers handlers for common mechanic repair events from:

  • ESXesx_mechanicjob:fixingvehicle, esx_mechanicjob:onFixkit, esx_mechanicjob:repairVehicle

  • QBCoreqb-mechanicjob:client:RepairVehicle, qb-mechanicjob:client:repairVehicle, qb-customs:client:repairVehicle

  • jim-mechanicjim-mechanic:client:repairVehicle, jim-mechanic:client:RepairVehicle, jim-mechanic:client:fixVehicle

  • okokMechanicJobokokMechanicJob:repairVehicle, okokMechanicJob:fixVehicle

  • Genericmechanic:client:repairVehicle, mechanic:client:fixVehicle

When any of these events fire, the script calls:

exports['s4-wheeldamage']:FullyRepairVehicle(vehicle)

The vehicle is resolved from the event payload (entity, vehicle, veh) or falls back to the player's current/nearby vehicle.

Native health watcher

A background thread monitors the player's vehicle health every 750ms. If the vehicle was previously damaged (health < 800) and is now fully repaired (health > 990) without s4-wheeldamage knowing, it triggers a compatibility repair.

This catches repair methods that use native functions directly (SetVehicleFixed, SetVehicleEngineHealth, etc.) without firing events.

Cooldown: 3 seconds between auto-repairs per vehicle.

Disable compatibility

Use this if you want s4-wheeldamage damage to persist even after external mechanic repairs, or if you handle integration manually via exports.

Add your own event

Edit compatible.lua and add your event name to the compatibilityEvents table:

Or trigger the export directly from your script: