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.
Signature
Section titled “Signature”mapIcons.getById(id: number): MapIcon | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
id |
number |
The ID from mapIcons.create. |
Returns
Section titled “Returns”The MapIcon, or undefined for an ID that is not one of your map icons.
Example
Section titled “Example”import { mapIcons, server } from "nativemp";
const markerId = 0; // the ID mapIcons.create returnedconst marker = mapIcons.getById(markerId);if (marker) server.log(`It is in virtual world ${marker.virtualWorld}`);Related
Section titled “Related”mapIcons.create: make onemapIcons.update: change itmapIcons.destroy: remove itmapIcons.listAll: all of them