OnClientSoundStopped: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 27: Line 27:
end
end
addEventHandler ( "onClientSoundStopped", getRootElement(), onSoundStopped )
addEventHandler ( "onClientSoundStopped", getRootElement(), onSoundStopped )
);
</syntaxhighlight>
</syntaxhighlight>



Revision as of 11:04, 7 July 2012

This event is triggered when a sound is stopped.

Parameters

string reason
  • reason: the reason the sound was stopped, can be "finished", "paused" or "destroyed".

Source

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

Example

This example outputs the reason the sound stopped.

function onSoundStopped ( reason )
    if ( reason == "destroyed" ) then
        outputChatBox ( "sound destroyed" )
    elseif ( reason == "finished" ) then
        outputChatBox ( "end of sound" )
    elseif ( reason == "paused" ) then
        outputChatBox ( "sound paused" )
    end
end
addEventHandler ( "onClientSoundStopped", getRootElement(), onSoundStopped )

See Also

Client sound events


Client event functions