OnClientFileDownloadComplete

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This event is triggered when a file has been downloaded after downloadFile has been successfully called.

Parameters

string fileName, bool success, resource requestResource
  • fileName: the file downloaded.
  • success: whether successful or not.
ADDED/UPDATED IN VERSION 1.5.7-20468 :

Source

The source of this event is the root element of the resource that downloaded file.

Example

This example plays a sound if it was downloaded successfully

function onDownloadFinish ( file, success )
    if ( source == resourceRoot ) then                            -- if the file relates to this resource
        if ( success ) then                                       -- if the file was downloaded successfully
            if ( file == "test.mp3" ) then                        -- if the file name is what we were expecting
                currentTrack = playSound ( "test.mp3" )
            end
        else                                                      -- if the file wasn't downloaded successfully
            if ( file == "test.mp3" ) then
                outputChatBox ( "test.mp3 failed to download" )
            end
        end
    end
end
addEventHandler ( "onClientFileDownloadComplete", root, onDownloadFinish )

See Also

Other client events


Client event functions