Skip to content

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.

vehicles.setNumberPlate(id: number, text: string | null): Promise<ActionResult>
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.

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.

gamemodes/my-mode.ts
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, " "));
});