Jump to content

download file + replace model


WzKhalifa

Recommended Posts

Posted

Help Help

I got a DownLoadFile in the community. However need to put a DxDrawImage on the bottom during download, and when I have the onClientDownloadComplete it replaces the TXD, if I log back .. no longer works .. does not replace again, I feel that we have put onClientResourceStart :?:

  
filePath = { 
    { "400.txd", 400 }; 
    { "400.dff", 400 }; 
-- { "Arquivo", ID }; 
}; 
  
modelID = {  }; 
  
function checkTransfer (  ) 
    if isTransferBoxActive (  ) == true then 
        setTimer ( checkTransfer, 1000, 1 ); 
    else 
        for i, v in ipairs ( filePath ) do 
            local file, ID = v [ 1 ], v [ 2 ]; 
            if not modelID [ file ] then 
                downloadFile ( file ); 
                modelID [ file ] = ID; 
            end 
        end 
    end 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, checkTransfer ); 
  
addEventHandler("onClientDownloadComplete", getRootElement(), 
 function ( file, success ) 
        if success then 
            local ID = modelID [ file ]; 
            if ID then 
                if string.find ( file, ".txd" ) then 
                    txd = engineLoadTXD ( file ); 
                    engineImportTXD ( txd, ID ); 
                end 
                if string.find ( file, ".dff" ) then 
                    dff = engineLoadDFF ( file, ID ); 
                    engineReplaceModel ( dff, ID ); 
                end 
            end 
        end 
    end 
); 
  

Posted

in the case was going to be like this? client finishes download + linking feature

function onDownloadFinish ( file, success ) 
        if success then 
            local ID = modelID [ file ]; 
            if ID then 
                if string.find ( file, ".txd" ) then 
                    txd = engineLoadTXD ( file ); 
                    engineImportTXD ( txd, ID ); 
                end 
                if string.find ( file, ".dff" ) then 
                    dff = engineLoadDFF ( file, ID ); 
                    engineReplaceModel ( dff, ID ); 
                end 
            end 
        end 
    end 
addEventHandler ( "onClientFileDownloadComplete", getRootElement(), onDownloadFinish ) 
addEventHandler ( "onClientResourceStart",  getRootElement(), onDownloadFinish ) 

Posted
in the case was going to be like this? client finishes download + linking feature
function onDownloadFinish ( file, success ) 
        if success then 
            local ID = modelID [ file ]; 
            if ID then 
                if string.find ( file, ".txd" ) then 
                    txd = engineLoadTXD ( file ); 
                    engineImportTXD ( txd, ID ); 
                end 
                if string.find ( file, ".dff" ) then 
                    dff = engineLoadDFF ( file, ID ); 
                    engineReplaceModel ( dff, ID ); 
                end 
            end 
        end 
    end 
addEventHandler ( "onClientFileDownloadComplete", getRootElement(), onDownloadFinish ) 
addEventHandler ( "onClientResourceStart",  getRootElement(), onDownloadFinish ) 

No need "onClientResourceStart" for function onDownloadFinish.

Posted

So actually I wanted to ask script download files, and soon after he bring down, he replacing textures of vehicles just downloaded, and so the player to reconnect replace it again, and so the feature start also replace the textures :?: help :idea:

Posted

This download function, is working just fine, however when the low player for the first time, he Substitutes vehicle, but when I log back in, it will not replace the texture, just wanted to ask for it to be replaced after downloading and when I log back in, and if possible put a dx stating that're on download :?:

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