players.setListenPosition
Sets where player hears nearby chat, whatever they do or watch:
for example a security camera room, or an admin who listens in on a scene. Their snapshot’s
listenPosition is then that point. Only what they hear moves; their character, and
what others see of it, stays where it is.
null puts it back to the default: where the player is, or where their view looks when it was started with
listenAtView. It lasts until you change it, the player leaves or the gamemode
reloads.
Signature
Section titled “Signature”players.setListenPosition(player: PlayerTarget, position: Vector3 | null): Promise<ActionResult>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
player |
PlayerTarget |
The player who listens. |
position |
Vector3 or null |
Where they hear, or null for the default. |
Returns
Section titled “Returns”A promise of an ActionResult: applied, or rejected with a code.
| Code | Meaning |
|---|---|
invalid-position |
Not three finite numbers, or off the map. |
player-not-found |
No such player, or they left meanwhile. |
Example
Section titled “Example”import { commands, players } from "nativemp";
const cctvRoom: [number, number, number] = [1555, -1675, 16];
commands.register("cctv", async (player, args) => { await players.setListenPosition(player, args === "off" ? null : cctvRoom);});Related
Section titled “Related”ViewListenOptions: hear where a camera, spectate or freecam lookschat.sendServerMessageNearby