Skip to content

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.

players.setListenPosition(player: PlayerTarget, position: Vector3 | null): Promise<ActionResult>
Name Type Description
player PlayerTarget The player who listens.
position Vector3 or null Where they hear, or null for the default.

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.
gamemodes/roleplay.ts
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);
});