Jump to content

SOLVED


joaosilva099

Recommended Posts

Posted (edited)

Hi all...

I Have this SIMPLE script to download and replace vehicle mods:

function replaceModel()  
   
  txd = engineLoadTXD("429.txd", 429 ) 
  engineImportTXD(txd, 429) 
  dff = engineLoadDFF("429.dff", 429 ) 
  engineReplaceModel(dff, 429) 
  
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel) 

But the problem is that with more mods i add it is raising the ammount of MB that the player has to download.

That script downloads mods and after that the player can join the game

I want is a script that only downloads the mods when the player logs in so that he can play same time the mods are downloading...

Hope u can help me

Thanks!

Edited by Guest

350x20_FFFFFF_FFFFFF_000000_000000.png

http://i.imgur.com/CSE28MJ.png

Don't hesitate to contact me for anything! If I can help, I will for sure!

Education is the most powerful weapon which you can use to change the world. - Castillo

Posted

Well there is a reasone of why the player can't play while downloading ( actualy there are more ... ). But one of them is :

the download will take the bandwidth, if the player has a bad internet connection then he will have a very nasty lag. Anyway it is possible check this out :

https://community.multitheftauto.com/in ... ls&id=3379

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

Posted

You can add mods in the Meta with attribute:

download = "false"

And downloadFile after the player logs in for example.

Contact me if you are looking for a Web Developer.

3rd of October 2014 - Founder of RomaniaZ

Posted

You can try to use this script, but I didn't test it

local files = {  
    ["files/mydff.dff"] = { id=400, type="dff" }, 
    ["files/mytxd.txd"] = { id=400, type="txd" }, 
} 
  
for i, v in pairs ( files ) do 
    downloadFile ( i )  
end 
  
  
addEventHandler ( "onClientFileDownloadComplete", root, function ( _, success ) 
    if ( success ) then 
        local allDone = true 
        for i, v in pairs ( files ) do  
            if ( not fileExists ( i ) ) then 
                allDone = false  
                break  
            end  
        end 
        if ( allDone ) then 
            for i, v in pairs( files ) do 
                local v.type = tostring ( v.type ):lower ( ) 
                if ( v.type == "dff" ) then 
                    local dff = engineLoadDFF ( i, 0 ) 
                    if ( not dff or not engineReplaceModel ( dff, v.id ) ) then 
                        outputDebugString ( "Failed to replace ".. tostring ( i  ).. " (Loading file as .dff | Tryed to replace model "..tostring(v.id)..")" ) 
                    end 
                elseif ( v.type == 'txd' ) then 
                    local txd = engineLoadTXD ( i ) 
                    if ( not txd or not engineImportTXD ( txd, v.id ) ) then 
                        outputDebugString ( "Failed to replace ".. tostring ( i  ).. " (Loading file as .txd | Tryed to replace model "..tostring(v.id)..")" ) 
                    end  
                else 
                    outputDebugString ( "Failed to replace ".. tostring ( i  ).. " (Unknown type -> Allowed: txd, dff)" ) 
                end 
            end  
        end 
    end  
end ) 

Posted
thumbsup.png

Maybe I will make a system of it, Idk.

nice bro can u please explaine to me how ? , with full script ofc if u have time

Failure is simply an opportunity to begin again more intelligently - Henry Ford

Posted

sorry bro i don't know where is the correct one can u post it here i'm sorry if i waste ur time.

Failure is simply an opportunity to begin again more intelligently - Henry Ford

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