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.
Signature
Section titled “Signature”vehicles.setMarker(id: number, options: VehicleMarkerAppearance | null): Promise<ActionResult>Parameters
Section titled “Parameters”| 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. |
Returns
Section titled “Returns”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. |
Example
Section titled “Example”import { vehicles } from "nativemp";
const vehicleId = 0; // the ID vehicles.create returnedawait vehicles.setMarker(vehicleId, { visible: true, colorRgba: 0x3366CCFF }); // blueawait vehicles.setMarker(vehicleId, { visible: false }); // hiddenawait vehicles.setMarker(vehicleId, null); // back to the defaultRelated
Section titled “Related”vehicleMarkerAppearanceRequest: every vehicle’s markerworld.setVehicleMarkersEnabled: the default