onClientFileDownloadComplete | Multi Theft Auto: Wiki Skip to content

onClientFileDownloadComplete

Client-side
Server-side
Shared

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.
  • requestResource: the resource that called downloadFile.

Source

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

Code Examples

client

This example plays a sound if it was downloaded successfully

addEventHandler("onClientFileDownloadComplete", root, function(file, success)
-- if the file relates to other resource
if source ~= resourceRoot then
return
end
-- if the file download failed
if not success then
outputChatBox(file..' failed to download')
return
end
-- check if filename ends with .mp3
if file:sub(-4) ~= '.mp3' then
return
end
-- if so, play the sound
playSound(file)
end)