Skip to content

players.playSound

Plays one of GTA:SA’s script sounds (the ones its missions play) for one player. Only that player hears it. NativeMP plays none by itself - not even when a player drives through a race checkpoint - so your gamemode decides when a sound plays.

players.playSound(player: PlayerTarget, soundId: number, position?: Vector3): Promise<ActionResult>
Name Type Description
player PlayerTarget The player, or their ID.
soundId number GTA:SA’s script sound, 1000 to 1199: its script audio event IDs; all of them on Sounds.
position Vector3 Optional. Where it plays. Leave it out to play it at the player.

Some sounds play the same wherever they are (the checkpoint and mission sounds); the rest are heard from position.

An ActionResult: applied once the player’s game played it, or rejected with invalid-sound, invalid-position, player-dead or player-not-found.

gamemodes/my-mode.ts
import { players, server } from "nativemp";
server.on("playerEnteredRaceCheckpoint", ({ player }) => {
void players.playSound(player, 1139); // the race checkpoint's ding
});

The whole list is on Sounds.

Sound What
1052 Ammu-Nation: a weapon bought
1056 The race countdown’s 3-2-1
1057 The race’s “go”
1058 Part of a mission complete
1137 Checkpoint, amber
1138 Checkpoint, green
1139 Checkpoint, red: the race checkpoint’s ding

A captured Player keeps this effect bound to its connection across awaits; see Async handlers.