OnClientSoundStopped: Difference between revisions
Jump to navigation
Jump to search
OpenIDUser34 (talk | contribs) (Created page with "{{Client_Function}} test example until properly documented <syntaxhighlight lang="lua"> function onSoundStopped ( reason ) if ( source == currentTrack ) then if ( reason == "destroyed" ) t...") |
OpenIDUser34 (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
{{ | {{Client event}} | ||
__NOTOC__ | |||
This event is triggered when a '''sound''' is stopped. | |||
==Parameters== | |||
<syntaxhighlight lang="lua"> | |||
string reason | |||
</syntaxhighlight> | |||
*'''reason''': the reason the '''sound''' was stopped, can be "finished", "paused" or "destroyed". | |||
==Source== | |||
The [[event system#Event source|source]] of this event is the [[Element/Sound|sound's element]]. | |||
==Example== | |||
This example outputs the reason the sound stopped. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function onSoundStopped ( reason ) | 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 | end | ||
addEventHandler ( "onClientSoundStopped", getRootElement(), onSoundStopped ) | addEventHandler ( "onClientSoundStopped", getRootElement(), onSoundStopped ) | ||
); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 13:37, 28 February 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
- onClientSoundBeat
- onClientSoundChangedMeta
- onClientSoundFinishedDownload
- onClientSoundStarted
- onClientSoundStopped
- onClientSoundStream
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled