Jump to content

Help fileIsEOF


boro

Recommended Posts

Hi all i have created this load script but debug say warning

WARNING: solider/replace.lua:10: Bad argument @ 'fileIsEOF' [Expected scriptfile at argument 1, got string 'solider.txd' ] 
  
  

 

This script work but why is showed this warning ??? please help

fileIsEOF i use for check if is file completely downloaded.

addEventHandler("onClientResourceStart",resourceRoot, 
    function () 
    downloadFile ( "solider.txd" ) 
    downloadFile ( "solider.dff" ) 
    soliderload = setTimer(solider, 60000, 0, source) 
    end 
) 
  
function solider () 
if fileExists("solider.txd") and fileExists("solider.dff") and fileIsEOF("solider.txd") and fileIsEOF("solider.dff") then 
    engineImportTXD(engineLoadTXD("solider.txd"), 16) 
    engineReplaceModel(engineLoadDFF("solider.dff", 0), 16) 
    killTimer ( soliderload ) 
    outputChatBox("soliderload") 
else 
    outputChatBox("soliderload dont are loaded") 
end 
end 
  

Link to comment

Yes i try this function but it dont work and mod dont are loaded

this dont work

function onDownloadFinish ( file, success ) 
    if ( source == resourceRoot ) then                            - 
        if ( success ) then                                        
            if ( file == "solider.txd" and file == "solider.dff" ) then                      
    engineImportTXD(engineLoadTXD("solider.txd"), 16) 
    engineReplaceModel(engineLoadDFF("solider.dff", 0), 16) 
    outputChatBox("soliderload") 
            end 
        end 
    end 
end 
addEventHandler ( "onClientFileDownloadComplete", getRootElement(), onDownloadFinish ) 

Link to comment

It's not a function.. it's an event.

Of course it won't work.. it gets triggered for each file separately.

Use something like this:

  
local filesDownloaded = {} 
function onDownloadFinish ( file, success )                     
        if ( success ) then 
            filesDownloaded[file] = true                                    
               if ( filesDownloaded["solider.txd"] and filesDownloaded["solider.dff"] ) then                     
                      engineImportTXD(engineLoadTXD("solider.txd"), 16) 
                      engineReplaceModel(engineLoadDFF("solider.dff", 0), 16) 
                      outputChatBox("soliderload") 
                end 
            end 
        end 
end 
addEventHandler ( "onClientFileDownloadComplete", resourceRoot, onDownloadFinish ) 

Link to comment

Now i test it but this dont work (no errors or warnings)

It's not a function.. it's an event.

Of course it won't work.. it gets triggered for each file separately.

Use something like this:

  
local filesDownloaded = {} 
function onDownloadFinish ( file, success )                     
        if ( success ) then 
            filesDownloaded[file] = true                                    
               if ( filesDownloaded["solider.txd"] and filesDownloaded["solider.dff"] ) then                     
                      engineImportTXD(engineLoadTXD("solider.txd"), 16) 
                      engineReplaceModel(engineLoadDFF("solider.dff", 0), 16) 
                      outputChatBox("soliderload") 
                end 
            end 
        end 
end 
addEventHandler ( "onClientFileDownloadComplete", resourceRoot, onDownloadFinish ) 

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