OnClientFileDownloadComplete: Difference between revisions
Jump to navigation
Jump to search
OpenIDUser34 (talk | contribs) No edit summary |
OpenIDUser34 (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
{{Client event}} | |||
{{Client event}} | __NOTOC__ | ||
This event is triggered when a file has been downloaded after [[downloadFile]] has been successfully called. | |||
==Parameters== | |||
<syntaxhighlight lang="lua"> | |||
string fileName, bool success | |||
</syntaxhighlight> | |||
*'''fileName''': the file downloaded. | |||
*'''success''': whether successful or not. | |||
==Source== | |||
The [[event system#Event source|source]] of this event is the [[root element]] of the resource that called [[downloadFile]]. | |||
==Example== | |||
This example plays a sound if it was downloaded successfully | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function onDownloadFinish ( file, success ) | function onDownloadFinish ( file, success ) | ||
if ( success ) then | if ( source == resourceRoot ) then | ||
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 | ||
end | end | ||
end | end | ||
addEventHandler ( "onClientFileDownloadComplete", getRootElement(), onDownloadFinish ) | addEventHandler ( "onClientFileDownloadComplete", getRootElement(), onDownloadFinish ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 73: | Line 36: | ||
===Other client events=== | ===Other client events=== | ||
{{Client_other_events}} | {{Client_other_events}} | ||
===Client event functions=== | |||
{{Client_event_functions}} |
Revision as of 17:16, 27 February 2012
This event is triggered when a file has been downloaded after downloadFile has been successfully called.
Parameters
string fileName, bool success
- fileName: the file downloaded.
- success: whether successful or not.
Source
The source of this event is the root element of the resource that called downloadFile.
Example
This example plays a sound if it was downloaded successfully
function onDownloadFinish ( file, success ) if ( source == resourceRoot ) then 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 end addEventHandler ( "onClientFileDownloadComplete", getRootElement(), onDownloadFinish )
See Also
Other client events
- onClientChatMessage
- onClientConsole
- onClientDebugMessage
- onClientExplosion
- onClientFileDownloadComplete
- onClientHUDRender
- onClientMinimize
- onClientMTAFocusChange
- onClientPedsProcessed
- onClientPlayerNetworkStatus
- onClientPreRender
- onClientRender
- onClientRestore
- onClientTransferBoxProgressChange
- onClientTransferBoxVisibilityChange
- onClientWorldSound
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled