IsAmbientSoundEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server client function}} This function allows you to check if some background sound effects are enabled. ==Syntax== <syntaxhighlight lang="lua"> bool isAmbientSoundEnabled( string ...")
 
No edit summary
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Client function}}
This function allows you to check if some background sound effects are enabled.
This function allows you to check if some background sound effects are enabled.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool isAmbientSoundEnabled( string type )
bool isAmbientSoundEnabled( string theType )
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''type:''' The type of ambient sound to test. Can be either "gunfire" or "general".
*'''theType:''' The type of ambient sound to test. Can be either "gunfire" or "general".


===Returns===
===Returns===
Returns ''true'' if the ambient sound is enabled, ''false'' if it is disabled or invalid values were passed.
Returns ''true'' if the ambient sound is enabled, ''false'' if it is disabled or invalid values were passed.
===Example===
This command checks if the type of  ambient sound is enabled or not.
/check <type>
<syntaxhighlight lang="lua">
addCommandHandler("check",function(_,_type)
if isAmbientSoundEnabled(_type) then
outputChatBox(_type.." is enabled!",0,255,0)
else
outputChatBox(_type.." is disabled!",255,0,0)
end
end)
</syntaxhighlight>


==See Also==
==See Also==
{{World functions}}
{{Client world functions}}

Latest revision as of 09:13, 12 July 2017

This function allows you to check if some background sound effects are enabled.

Syntax

bool isAmbientSoundEnabled( string theType )

Required Arguments

  • theType: The type of ambient sound to test. Can be either "gunfire" or "general".

Returns

Returns true if the ambient sound is enabled, false if it is disabled or invalid values were passed.

Example

This command checks if the type of ambient sound is enabled or not. /check <type>

addCommandHandler("check",function(_,_type)
	if isAmbientSoundEnabled(_type) then
		outputChatBox(_type.." is enabled!",0,255,0)
	else
		outputChatBox(_type.." is disabled!",255,0,0)
	end
end)

See Also

Shared