Jump to content

Script Download!


Recommended Posts

Ce am gresit aici? De nu merge?

--download system 
  
local numberOfIndex = { "585.txd", "585.dff" } 
  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), 
    function () 
        for _, index in ipairs ( numberOfIndex ) do 
            if fileExists( index ) then 
                setElementData(localPlayer, "modsDownloaded", true) 
            return 
        end 
        executeCommandHandler("checkthisshit") 
        setElementData(localPlayer, "modsDownloaded", false) 
        exports.download:downloadFile("".. index .."", "".. index .."", 500) 
        outputChatBox("".. index .."", localPlayer, 255, 0, 200, false) 
        exports.download:downloadFile("585.dff", "585.dff", 500) 
    end 
end 
) 
  
  
addEventHandler("onClientDownloadComplete", getRootElement(), -- woowww super long function. I think this could be done way shorter. (im a newb) 
function (theFile) 
    if theFile == ":Mods/585.txd" then 
        outputChatBox("585.txd has been downloaded!", localPlayer, 255, 255, 255, false) 
    end 
    if theFile == ":Mods/585.dff" then 
        outputChatBox("585.dff has been downloaded!", localPlayer, 255, 255, 255, false) 
        triggerEvent("downloadWindowFalse", localPlayer) 
        setElementData(localPlayer, "modsDownloaded", true)  
    end 
end 
) 

    <file src="585.txd" download="false"/> 
    <file src="585.dff" download="false"/> 
  

Link to comment
  • 2 years later...

Salut, știu că e de mult topicul, dar poate te mai uiți.

function(descarcaFisier)
    downloadFile('fisier.txd') -- > Aici pui fisiere
  -- Exemple mai multe:
    downloadFile('infernus.txd')
    downloadFile('infernus.dff')
end
addEventHandler('onClientResourceStart', resourceRoot, descarcaFisier)

Meta:

<meta>
 <script src='resursa.lua'/>
 <file src='infernus.dff' download='false' />
 <file src='infernus.txd' download='false' />
</meta>

Dacă vrei și loader:

function incarcaMod (resursaPornita) 
if(resursaPornita == getThisResource()) then 
outputChatBox('Status Moduri > Încărcate.', 0, 255, 0) 
txd = engineLoadTXD('infernus.txd')
engineImportTXD (txd, 411) 
dff = engineLoadDFF('infernus.dff', 411) 
engineReplaceModel (dff, 411) 
             end 
end 
addEventHandler("onClientResourceStart", getRootElement(), incarcaMod)

 

Edited by F4sT
Ceva bugfixuri.
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...