Jump to content

downloadFile


Recommended Posts

Posted

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"

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

1.3.5

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

How many topics are you planning to create about this problem? :P

Why don't you just set download to "true" so clients will download them automatically?

Do you really want to waste any more time on this way of handling it? :/

Posted

Oh ok then ,thanks, is there another way to do it?

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

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...