Jump to content

help in downloadFile


Recommended Posts

11 hours ago, darbka2002 said:

hello, 

i have a problem in downloadFile

when i use downloadFile("test.png")

The file is loaded but the size is 0 byet

and i add the file in meta and download="false" 

help.
 

try this 

function onThisResourceStart ( )
    downloadFile ( "test.png" )
end
addEventHandler ( "onClientResourceStart", resourceRoot, onThisResourceStart )

function onDownloadFinish ( file, success )
    if ( source == resourceRoot ) then                            
        if ( success ) then                                       
            if ( file == "test.png" ) then                        
                outputChatBox ( "test.png downloaded" )                
            end
        else                                                      
            if ( file == "test.png" ) then
                outputChatBox ( "test.png failed to download" )
            end
        end
    end
end
addEventHandler ( "onClientFileDownloadComplete", root, onDownloadFinish )

And also add in meta.xml the attribute download="false" 

and also add this line in your meta 

 <min_mta_version client="1.5.4" server="1.5.4" />
    

:) happy scripting

Edited by Ayush Rathore
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...