Jump to content

Download (fetchRemote)


Recommended Posts

Hello,

Can anyone explains for me (give me an example) how to use properly fetchRemote to download two files(txd,dff) and replace a vehicle model with the downloaded files.

Thank you,

I'm pretty sure that the best answer will help hundred of scripters to handle fetchRemote and download problems.

Link to comment

Client side

  
 fetchRemote ( "www.TheDirectLinkToDFFoRtxdFILE.com/blahblah/file.txd",  ReturnVal, "", false ) -- lets try downloading txd file from a direct link 
  
function ReturnVal( returnedDATA, errno ) 
    if errno == 0 then 
    _MyTxd = engineLoadTXD (returnedDATA) 
engineImportTXD ( _MyTxd, 1564 ) -- make sure you replace 1564 with the value you want 
else 
outputChatBox ("OMG DOWNLOADING FAILED DUE TO: "..errno) 
    end 
end 

Not tested. If it doesn't work then please try /debugscript 3 and tell me what does it outputs.

Link to comment
You must save the file client-side and then use that file via engineLoadTXD.

I thought of adding it but I thought maybe the client downloads it and is auto saved. : D

Anyway I'm on mobile now so to make it work correctly use fileCreate.

Link to comment

You can send the files via triggerLatentClient to the client. Just read them out with fileRead and send the source to the client.

On the client, just create the file, write the source into it and then you can load it for whatever you want.

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