playerEnteredArea
Tells your gamemode that a player came into one of your areas, on foot or in a vehicle. Only for a player the area is for, in its interior and virtual world; a hidden area still counts. Nothing else happens unless your gamemode does it.
Renamed in 0.28 from zoneEnter; see renamed names.
Signature
Section titled “Signature”server.on("playerEnteredArea", ({ player, area }) => void)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
player |
PlayerSnapshot |
The player. |
area |
Area |
The area, from areas.create. Its old name zone still works, with a warning. |
Example
Section titled “Example”import { areas, screen, server } from "nativemp";
const safe = await areas.create({ min: [1780, -2500, 0], max: [1800, -2480, 50], colorRgba: 0x00FF0060 });
server.on("playerEnteredArea", ({ player, area }) => { if (safe.status === "applied" && area.id === safe.createdId) screen.showGameText("~g~Safe", { player, durationMs: 2000, style: 3 });});Related
Section titled “Related”playerLeftArea: they went outPlayerAreaPayload- World markers: when the events come