OnClientWorldSound: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(Example added) |
||
Line 21: | Line 21: | ||
If this event is [[Event system#Canceling|canceled]], the sound won't play at all. | If this event is [[Event system#Canceling|canceled]], the sound won't play at all. | ||
==Example== | ==Example== | ||
This example will cancel every vehicle sound. | |||
<syntaxhighlight lang="lua"> | |||
addEventHandler("onClientWorldSound", resourceRoot, function() | |||
if getElementType(source) == "vehicle" then | |||
cancelEvent() | |||
end | |||
end) | |||
</syntaxhighlight> | |||
==See Also== | ==See Also== |
Revision as of 07:02, 26 May 2019
This event triggers whenever a GTA sound starts playing.
Parameters
int group, int index, float x, float y, float z
- group: An integer representing the world sound group
- index: An integer representing an individual sound within the group
- x: a floating point number representing the X coordinate on the map.
- y: a floating point number representing the Y coordinate on the map.
- z: a floating point number representing the Z coordinate on the map.
Source
The source of this event is the element, which emitted the sound.
Cancel effect
If this event is canceled, the sound won't play at all.
Example
This example will cancel every vehicle sound.
addEventHandler("onClientWorldSound", resourceRoot, function() if getElementType(source) == "vehicle" then cancelEvent() end end)
See Also
World sound functions
Client other events
- onClientChatMessage
- onClientConsole
- onClientDebugMessage
- onClientExplosion
- onClientFileDownloadComplete
- onClientHUDRender
- onClientMinimize
- onClientMTAFocusChange
- onClientPedsProcessed
- onClientPlayerNetworkStatus
- onClientPreRender
- onClientRender
- onClientRestore
- onClientTransferBoxProgressChange
- onClientTransferBoxVisibilityChange
- onClientWorldSound
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled