setSoundEffectEnabled | Multi Theft Auto: Wiki Skip to content

setSoundEffectEnabled

Client-side
Server-side
Shared

Used to enable or disable specific sound effects. Use a player element to control a players voice with this function.

OOP Syntax Help! I don't understand this!

  • Method: sound:setEffectEnabled(...)

Syntax

bool setSoundEffectEnabled ( sound/player theSound, string effectName, bool enable )
Required Arguments
  • theSound: A sound element or a player element which will affect the voice broadcast.
  • effectName: The effect you want to enable or disable.
    • gargle
    • compressor
    • echo
    • i3dl2reverb
    • distortion
    • chorus
    • parameq
    • reverb
    • flanger
  • enable: true if you want to enable the effect, false if you want to disable it.

Returns

  • bool: result

Returns true if the effect was set successfully, false otherwise.

Code Examples

client

This example creates a sound and set's the flanger sound effect enabled.

addCommandHandler("flanger", function(cmd, enabled)
if isElement(waterSplashes) then
setSoundEffectEnabled(waterSplashes, cmd, enabled)
else
waterSplashes = playSound("splashes.mp3", true)
setSoundEffectEnabled(waterSplashes, cmd, enabled)
end
end, true) --set it case sensitive as we are going to get the command name and use it in the setSoundEffectEnabled

Changelog

  • 1.3.2Added player element for voice control.