Skip to content

mapIcons.create

Puts an icon on the radar and the pause menu’s map: a shop, a job, a meeting point. Each player sees the nearest 64 within its range; they share the radar with the player and vehicle markers, and an icon waits while the radar is full.

mapIcons.create(settings: MapIconSettings): Promise<ActionResult>
Name Type Description
settings.position Vector3 Where it is, [x, y, z].
settings.icon number Optional. One of the game’s radar icons, 0 to 63. Defaults to 0, a plain dot in colorRgba.
settings.colorRgba number Optional. The plain dot’s color, 0xRRGGBBAA; every other icon keeps its own colors. Defaults to white.
settings.range number Optional. How near a player must be to see it, in metres, up to 6000. Defaults to 0, the whole map.
settings.interior number Optional. The interior it is in: 0 outside (the default), 1 to 18 an interior’s, 13 every interior.
settings.virtualWorld number Optional. The virtual world it is in (default 0), or virtualWorlds.every for every one.
settings.visible boolean Optional. false hides it from everyone. Defaults to true.
settings.players PlayerTarget[] | null Optional. Only these players see it, while they are connected. Left out or null: everyone.

A promise of an ActionResult: applied with the new map icon’s ID in createdId, or rejected with invalid-position, invalid-icon, invalid-range, invalid-area, invalid-world, invalid-colour, invalid-value or invalid-players. A player in players who has left gives player-not-found. The server keeps up to 4,096 text labels, map icons, checkpoints and areas together, at most 1,024 of them checkpoints and areas (host-marker-limit when full).

Players who join later, or come back, see it too. One for chosen players is destroyed when the last of them leaves: make it again when they come back. All of them go when your gamemode stops or reloads.

gamemodes/my-mode.ts
import { mapIcons, server } from "nativemp";
const result = await mapIcons.create({ position: [2244, -1665, 15], icon: 45 });
if (result.status === "applied") server.log(`Map icon ${result.createdId} is up`);