GetSoundEffects: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
m (Added polish translation)
 
(12 intermediate revisions by 11 users not shown)
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">table getSoundEffects ( element sound )</syntaxhighlight>  
<syntaxhighlight lang="lua">table getSoundEffects ( element sound )</syntaxhighlight>  
 
{{OOP||[[sound]]:getEffects}}
===Required Arguments===  
===Required Arguments===  
*'''sound:''' a [[sound]] element.
*'''sound:''' a [[sound]] element.
Line 17: Line 17:
==Example==  
==Example==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- TODO
function switchEffects(sound)
for _,v in ipairs(getSoundEffects(sound)) do -- Go through the whole list of sound effects for the sound
if v == "gargle" then -- If the sound effect is 'gargle', proceed
setSoundEffectEnabled(sound, "gargle", false) -- Disable the 'gargle' -effect
end
end
end
</syntaxhighlight>
</syntaxhighlight>


Line 23: Line 29:
{{Client_audio_functions}}
{{Client_audio_functions}}


[[Category:Needs_Example]]
[[ar:getSoundEffects]]
[[de:getSoundEffects]]
[[hu:getSoundEffects]]
[[pl:getSoundEffects]]
[[PT-BR:getSoundEffects]]
[[ru:getSoundEffects]]
[[RO:getSoundEffects]]

Latest revision as of 12:31, 10 April 2023

Returns the states of all effects of a sound.

Syntax

table getSoundEffects ( element sound )

OOP Syntax Help! I don't understand this!

Method: sound:getEffects(...)


Required Arguments

Returns

Returns a table with the effect names as the keys, and their states as the values if successful. Otherwise, it returns false.

Sound effect names:

  • gargle
  • compressor
  • echo
  • i3dl2reverb
  • distortion
  • chorus
  • parameq
  • reverb
  • flanger

Example

function switchEffects(sound)
	for _,v in ipairs(getSoundEffects(sound)) do -- Go through the whole list of sound effects for the sound
		if v == "gargle" then -- If the sound effect is 'gargle', proceed
			setSoundEffectEnabled(sound, "gargle", false) -- Disable the 'gargle' -effect
		end
	end
end

See Also