|
|
| Line 1: |
Line 1: |
| __NOTOC__
| | #REDIRECT [[setWorldSoundEnabled]] |
| {{Client event}}
| |
| | |
| This event is triggered whenever a world sound is played. A world sound is a sound effect which has '''''not''''' been caused by [[playSound]] or [[playSound3D]].
| |
| | |
| ''Note: onClientWorldSound should only be used to stop world sounds from playing. To replace a world sound with a custom sound, it is suggested that you detect when to play the replacement by other means.''
| |
| | |
| ==Parameters==
| |
| <syntaxhighlight lang="lua">
| |
| int group, int index
| |
| </syntaxhighlight>
| |
| | |
| *'''group''': An integer representing the world sound group
| |
| *'''index''': An integer representing an individual sound within the group
| |
| | |
| ==Source==
| |
| The [[event system#Event source|source]] of this event is the root element
| |
| | |
| ==Cancel effect==
| |
| If this event is [[Event system#Canceling|canceled]], then the sound will not be played.
| |
| | |
| ==Example==
| |
| This example prints the world sound group and index in the chat box, and stops all world sound effects in group 5
| |
| <syntaxhighlight lang="lua">
| |
| function handleOnClientWorldSound( group, index )
| |
| outputChatBox( "World sound group:" .. group .. ", index:" .. index )
| |
| if group == 5 then
| |
| cancelEvent() -- Don't play this
| |
| end
| |
| end
| |
| addEventHandler ( "onClientWorldSound", getRootElement(), handleOnClientWorldSound)
| |
| </syntaxhighlight>
| |
| | |
| ==Requirements==
| |
| {{Requirements|n/a|1.3.0-9.04082|}}
| |
| | |
| ==See Also==
| |
| ===Client sound events===
| |
| {{Sound_events}}
| |