Skip to content

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.

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

The Area, or undefined for an ID that is not one of your areas.

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