Skip to content

vehicleDamaged

Tells your gamemode that vehicle health or supported damage-manager condition changed. Game collision damage is reported after the simulation has applied it, so your handler can inspect the result and correct it with vehicles.setCondition or vehicles.repair.

server.on("vehicleDamaged", ({ vehicleId, state, changeSource, observedAtSessionMs }) => void)
Name Type Description
vehicleId number The vehicle’s network ID.
state VehicleStateSnapshot The current controls and supported condition.
changeSource "game" | "script" | "repair" Damage from the game, a condition setter, or repair.
observedAtSessionMs number When the change was observed on the shared session clock.
gamemodes/my-mode.ts
import { server, vehicles } from "nativemp";
server.on("vehicleDamaged", ({ vehicleId, state }) => {
if ((state.condition?.health ?? 1000) < 250) void vehicles.repair(vehicleId);
});