Jump to content

I make a download script but big problem


ParadoxTR

Recommended Posts

Posted
local downloadFiles = { 
    
{"dosyalar/400.dff"},
{"dosyalar/400.txd"},
{"dosyalar/401.dff"},
{"dosyalar/401.txd"},
...(so much)

addEventHandler("onClientResourceStart", resourceRoot,function()
        Arkaplan = guiCreateStaticImage((0/1600)*w, (846/900)*h, (357/1600)*w, (54/900)*h, "resim.png", false)
        guiSetVisible(Arkaplan,true)
        Label1 = guiCreateLabel((1/1600)*w, (1/900)*h, (356/1600)*w, (27/900)*h, "Araçlar İndiriliyor (499.1 MB)", false, Arkaplan)
        guiSetFont(Label1, "default-bold-small")
        guiLabelSetColor(Label1, 254, 113, 0)
        guiLabelSetHorizontalAlign(Label1, "center", false)
        guiLabelSetVerticalAlign(Label1, "center")
        Label2 = guiCreateLabel((1/1600)*w, (27/900)*h, (356/1600)*w, (27/900)*h, "%0", false, Arkaplan)
        guiSetFont(Label2, "default-bold-small")
        guiLabelSetColor(Label2, 254, 113, 0)
        guiLabelSetHorizontalAlign(Label2, "center", false)
        guiLabelSetVerticalAlign(Label2, "center")     
for _, downFile in pairs(downloadFiles) do 
    downloadFile(downFile[1]) 
end 
end) 

addEventHandler ( "onClientFileDownloadComplete", resourceRoot, 
    function ( file, success)
        if ( success) then 
-----------------------------ARAÇLAR------------------------------        
            if ( file == "dosyalar/400.dff") then
                guiSetText(Label2,"%0")
                guiSetText(Label1,"Araçlar İndiriliyor (512 MB)")
            end
            if ( file == "dosyalar/400.txd") then
                guiSetText(Label2,"%1")
                txd = engineLoadTXD("dosyalar/400.txd",400)
                engineImportTXD(txd,400)
                dff = engineLoadDFF("dosyalar/400.dff",400)
                engineReplaceModel(dff,400)
                setElementData(localPlayer,"MB1",true)                
            end
-------------------------------------------------------------
            if ( file == "dosyalar/401.dff") then
                guiSetText(Label2,"%2")
            end
            if ( file == "dosyalar/401.txd") then
                guiSetText(Label2,"%3")
                txd = engineLoadTXD("dosyalar/401.txd",401)
                engineImportTXD(txd,401)
                dff = engineLoadDFF("dosyalar/401.dff",401)
                engineReplaceModel(dff,401)
                setElementData(localPlayer,"MB2",true)                
            end
...(so much)

 

It's affecting performance. What is the problem?

01l1DR.png

 

Posted

Are you  getting any errors or what's the issue? Performance will evidently be an issue if you're trying to download that many files at once and importing custom DFF/TXD files.

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