OnClientFileDownloadComplete: Difference between revisions
Jump to navigation
Jump to search
(→Source) |
|||
Line 15: | Line 15: | ||
The [[event system#Event source|source]] of this event is the [[root element]] of the resource that called [[downloadFile]]. | The [[event system#Event source|source]] of this event is the [[root element]] of the resource that called [[downloadFile]]. | ||
== | ==مثال== | ||
يلعب هذا المثال صوتا إذا تم تنزيله بنجاح | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function onDownloadFinish ( file, success ) | function onDownloadFinish ( file, success ) | ||
if ( source == resourceRoot ) then -- | if ( source == resourceRoot ) then -- إذا كان الملف يتعلق بهذا المورد | ||
if ( success ) then -- | if ( success ) then -- إذا تم تحميل الملف بنجاح | ||
if ( file == "test.mp3" ) then -- | if ( file == "test.mp3" ) then -- اذا كان اسم الملف هو ما كونا نتوقعه | ||
currentTrack = playSound ( "test.mp3" ) | currentTrack = playSound ( "test.mp3" ) | ||
end | end | ||
else -- | else -- إذا لم يتم تحميل الملف بنجاح | ||
if ( file == "test.mp3" ) then | if ( file == "test.mp3" ) then | ||
outputChatBox ( "test.mp3 failed to download" ) | outputChatBox ( "test.mp3 failed to download" ) |
Revision as of 13:17, 10 April 2017
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.
مثال
يلعب هذا المثال صوتا إذا تم تنزيله بنجاح
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", root, 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