ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. downloadFile

Function

downloadFile

ClientMiscellaneousIdentical to MTA:SA

Downloads a resource file marked in meta.xml as <file src="..." download="false"/> only when it is needed (e.g. a large music file). The result arrives in the onClientFileDownloadComplete event, always asynchronously, also when the file was already downloaded. ":resource/file" downloads another resource's file.

Syntax

bool downloadFile(string fileName)

Arguments

fileNamestring
The file path.

Returns

true if the download started.

Example

addEventHandler("onClientFileDownloadComplete", resourceRoot, function(name, ok)
    if ok and name == "muzyka/intro.mp3" then playSound(name) end
end)
downloadFile("muzyka/intro.mp3")

See also