M MY Multiplayer: Wiki
Side
Kind

onClientWorldSound

ClientEventCancellable

Fired when the game is about to play a world sound. Cancelling the event keeps the sound from playing.

addEventHandler("onClientWorldSound", root, function(int group, int index, float x, y, z) … end)

Handler parameters

NameTypeDescription
groupintThe sound's group (SA's bank slot).
indexintThe sound's index inside the group.
x, y, zfloatWhere the sound plays.

Source

The element of the entity making the sound (a ped, vehicle or object), or the root element (root) if there is none.

Example

addEventHandler("onClientWorldSound", localPlayer, function(group, index)
    if group == 5 then
        cancelEvent()
    end
end)
NoteCollision sounds worked out by the parallel physics and sounds with an index above 399 play without firing the event. A sound turned off with setWorldSoundEnabled does not fire it either.

See also