areas.getById
Returns one of your areas by its ID, or undefined when there is none.
Renamed in 0.28 from zones.get; see renamed names.
Signature
Section titled “Signature”areas.getById(id: number): Area | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
id |
number |
The ID from areas.create. |
Returns
Section titled “Returns”The Area, or undefined for an ID that is not one of your areas.
Example
Section titled “Example”import { areas, server } from "nativemp";
const areaId = 0; // the ID areas.create returnedconst area = areas.getById(areaId);if (area) server.log(`It is in virtual world ${area.virtualWorld}`);Related
Section titled “Related”areas.create: make oneareas.update: change itareas.destroy: remove itareas.listAll: all of them