vehicles.setNumberPlate
Gives one vehicle its own plate text for every player. Two vehicles of the same model can show different plates.
null gives it back the model’s own plate.
Signature
Section titled “Signature”vehicles.setNumberPlate(id: number, text: string | null): Promise<ActionResult>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
id |
number |
The vehicle’s network ID. |
text |
string | null |
Up to 8 letters A-Z, digits and spaces. Lower case shows as upper case. null: the model’s plate. |
Returns
Section titled “Returns”A promise of an ActionResult: "applied", or rejected with invalid-number-plate or
vehicle-not-found. Models without a plate, such as most bikes, accept it and show nothing.
Example
Section titled “Example”import { server, vehicles } from "nativemp";
server.on("playerEnteredVehicle", async ({ player, vehicleId, seat }) => { if (seat === 0) await vehicles.setNumberPlate(vehicleId, player.name.slice(0, 8).replace(/[^A-Za-z0-9 ]/g, " "));});Related
Section titled “Related”vehicles.getAppearance: read the plate