Skip to content

vehicles.setMarker

Sets one vehicle’s radar marker for every player: whether it shows, and its color. It wins over the default and over vehicleMarkerAppearanceRequest, until you clear it. It stays when your gamemode reloads.

vehicles.setMarker(id: number, options: VehicleMarkerAppearance | null): Promise<ActionResult>
Name Type Description
id number The vehicle.
options VehicleMarkerAppearance or null { visible?, colorRgba? }; a field left out keeps its default. null clears what you set.

A promise of an ActionResult: applied, or rejected with:

Code Meaning
persistent-vehicle-not-found No such vehicle.
invalid-vehicle-id The ID is not a vehicle ID.
invalid-marker options is not an object or null, or visible is not a boolean.
invalid-colour colorRgba is not 0 to 0xFFFFFFFF.
gamemodes/my-mode.ts
import { vehicles } from "nativemp";
const vehicleId = 0; // the ID vehicles.create returned
await vehicles.setMarker(vehicleId, { visible: true, colorRgba: 0x3366CCFF }); // blue
await vehicles.setMarker(vehicleId, { visible: false }); // hidden
await vehicles.setMarker(vehicleId, null); // back to the default