vehicles.repair
Restores health to 1000 and clears supported engine, panel, light, tyre and door damage on any active networked vehicle. It keeps control settings and open positions, and does not change whether the vehicle is wrecked.
Signature
Section titled “Signature”vehicles.repair(id: number): Promise<ActionResult>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
id |
number |
The vehicle’s network ID. |
Returns
Section titled “Returns”A promise of an ActionResult: applied once the server updates its state, rejected for
an unknown vehicle, or timeout if the server does not answer within five seconds. If condition changes, the server
emits vehicleDamaged with changeSource: "repair".
Repair preserves engine on/off, headlight mode, lock, siren, window positions, and which supported doors, hood or trunk are open. A wrecked vehicle remains wrecked; use your vehicle lifecycle logic if it should be replaced.
Example
Section titled “Example”import { server, vehicles } from "nativemp";
server.on("vehicleDamaged", ({ vehicleId, state }) => { if ((state.condition?.health ?? 1000) < 250) void vehicles.repair(vehicleId);});Related
Section titled “Related”vehicles.getCondition: read health and conditionvehicles.setCondition: adjust selected condition fieldsvehicleDamaged: hear about damage and repair