OnClientFileDownloadComplete: Difference between revisions
Jump to navigation
Jump to search
OpenIDUser34 (talk | contribs) No edit summary |
OpenIDUser34 (talk | contribs) No edit summary |
||
Line 40: | Line 40: | ||
function onSoundStarted ( reason ) | function onSoundStarted ( reason ) | ||
if ( reason == "play" ) then | |||
outputChatBox ( "sound started" ) | |||
elseif ( reason == "resumed" ) then | |||
outputChatBox ( "sound resumed" ) | |||
end | end | ||
end | end |
Revision as of 22:13, 22 February 2012
my test example until I get a chance to document properly
currentTrack = nil function onStart ( ) downloadFile ( "test.mp3" ) end addEventHandler ( "onClientResourceStart", getRootElement(), onStart ) function onDownloadFinish ( file, success ) if ( success ) then if ( file == "test.mp3" ) then currentTrack = playSound ( "test.mp3" ) end else if ( file == "test.mp3" ) then outputChatBox ( "test.mp3 failed to download" ) end end end addEventHandler ( "onClientFileDownloadComplete", getRootElement(), onDownloadFinish ) function onSoundStopped ( reason ) if ( source == currentTrack ) then 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 ) function onSoundStarted ( reason ) if ( reason == "play" ) then outputChatBox ( "sound started" ) elseif ( reason == "resumed" ) then outputChatBox ( "sound resumed" ) end end addEventHandler ( "onClientSoundStarted", getRootElement(), onSoundStarted ) function stopSoundFunction () stopSound ( currentTrack ) end addCommandHandler ( "stop1", stopSoundFunction ) function songPause() local pause = isSoundPaused ( currentTrack ) if ( pause == true ) then setSoundPaused ( currentTrack, false ) else setSoundPaused ( currentTrack, true ) end end addCommandHandler("pause", songPause) function startSoundFunction () currentTrack = playSound ( "test.mp3" ) end addCommandHandler ( "start1", startSoundFunction )
See Also
Other client events
- onClientChatMessage
- onClientConsole
- onClientDebugMessage
- onClientExplosion
- onClientFileDownloadComplete
- onClientHUDRender
- onClientMinimize
- onClientMTAFocusChange
- onClientPedsProcessed
- onClientPlayerNetworkStatus
- onClientPreRender
- onClientRender
- onClientRestore
- onClientTransferBoxProgressChange
- onClientTransferBoxVisibilityChange
- onClientWorldSound