Jump to content

downloadFile


Recommended Posts

Hello, Can somebody see what's wrong here?

Error in debugscript3

ERROR:Test/client:2:Attempt to call global 'downloadFile (a nil value)

It suppose to download the car mod and apply it.

client

function onThisResourceStart ( ) 
    downloadFile ( "579.dff" ) 
    downloadFile ( "579.txd" ) 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, onThisResourceStart ) 
  
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 == "579.txd" ) then 
                txd = engineImportTXD (file) 
                engineReplaceModel ( txd, 579 ) 
            end 
        else                                                      -- if the file wasn't downloaded successfully 
            if ( file == "579.txd" ) then  
                outputChatBox ( "579.txd failed to download" ) 
            end 
        end 
    end 
end 
addEventHandler ( "onClientFileDownloadComplete", getRootElement(), onDownloadFinish ) 
  
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 == "579.dff" ) then 
                dff = engineLoadDFF (file) 
                engineReplaceModel ( dff, 579 ) 
            end 
        else                                                      -- if the file wasn't downloaded successfully 
            if ( file == "579.dff" ) then  
                outputChatBox ( "579.dff failed to download" ) 
            end 
        end 
    end 
end 
addEventHandler ( "onClientFileDownloadComplete", getRootElement(), onDownloadFinish ) 

Meta.xml

<meta> 
    <script src="client.lua" type="client"></script> 
    <file src="579.txd" download="false"></file> 
    <file src="579.dff" download="false"></file> 
</meta> 
  

P.S: the files are located in the Test folder ":Test/579.txd" ":Test/579.dff"

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...