OnClientSoundStarted: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Client event}}
{{Client event}}
__NOTOC__  
__NOTOC__  
{{New items|3.0151|1.4|
{{New items|3.0140|1.4|
This event is triggered when a '''sound''' is started.
This event is triggered when a '''sound''' is started.
}}
}}
Line 9: Line 9:
</syntaxhighlight>  
</syntaxhighlight>  


*'''reason''': the reason the '''sound''' was started, can be "play" or "resumed".
*'''reason''': the reason the '''sound''' was started, can be "play", "resumed" or "enabled".


==Source==
==Source==

Latest revision as of 20:35, 2 September 2019

This event is triggered when a sound is started.

Parameters

string reason
  • reason: the reason the sound was started, can be "play", "resumed" or "enabled".

Source

The source of this event is the sound's element.

Example

This example outputs the reason the sound started .

function onSoundStarted ( reason )
    if ( reason == "play" ) then
        outputChatBox ( "sound started" )
    elseif ( reason == "resumed" ) then
        outputChatBox ( "sound resumed" )
    end
end
addEventHandler ( "onClientSoundStarted", getRootElement(), onSoundStarted )

See Also

Client sound events


Client event functions