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
| Name | Type | Description |
|---|---|---|
| group | int | The sound's group (SA's bank slot). |
| index | int | The sound's index inside the group. |
| x, y, z | float | Where 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.