Skip to content

mapIcons.getById

Returns one of your map icons by its ID, or undefined when there is none.

Renamed in 0.28 from mapIcons.get; see renamed names.

mapIcons.getById(id: number): MapIcon | undefined
Name Type Description
id number The ID from mapIcons.create.

The MapIcon, or undefined for an ID that is not one of your map icons.

gamemodes/my-mode.ts
import { mapIcons, server } from "nativemp";
const markerId = 0; // the ID mapIcons.create returned
const marker = mapIcons.getById(markerId);
if (marker) server.log(`It is in virtual world ${marker.virtualWorld}`);