boro Posted November 4, 2014 Posted November 4, 2014 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 I'll help When I Can.
MTA Team botder Posted November 4, 2014 MTA Team Posted November 4, 2014 Could you use OnClientFileDownloadComplete instead? GitHub: Debug Console • MTA-Discord Relay Scripting: How to draw a line chart with DirectX functions? • Doppler Effect in MTA • Get the client's FPS • Customizable Blur Shader
boro Posted November 4, 2014 Author Posted November 4, 2014 i try this function but this dont work good I'll help When I Can.
MIKI785 Posted November 4, 2014 Posted November 4, 2014 You're supposed to use file element not the name as string.. It wouldn't work anyway as it only checks if the position inside the file used in file functions is at the end of the file. That's not what you want. Lua Scripter Owner of mshost.cz MTA portal.
boro Posted November 4, 2014 Author Posted November 4, 2014 ok and how i check when is file completely downloaded ? because if file dont are checked and dont are loaded correctly then dont work help MIKI I'll help When I Can.
MIKI785 Posted November 4, 2014 Posted November 4, 2014 Using OnClientFileDownloadComplete is the best way. Lua Scripter Owner of mshost.cz MTA portal.
boro Posted November 4, 2014 Author Posted November 4, 2014 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 ) I'll help When I Can.
MIKI785 Posted November 4, 2014 Posted November 4, 2014 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 ) Lua Scripter Owner of mshost.cz MTA portal.
boro Posted November 4, 2014 Author Posted November 4, 2014 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 ) I'll help When I Can.
MTA Team botder Posted November 4, 2014 MTA Team Posted November 4, 2014 Did you also use this? addEventHandler("onClientResourceStart",resourceRoot, function () downloadFile ( "solider.txd" ) downloadFile ( "solider.dff" ) end ) GitHub: Debug Console • MTA-Discord Relay Scripting: How to draw a line chart with DirectX functions? • Doppler Effect in MTA • Get the client's FPS • Customizable Blur Shader
Et-win Posted November 5, 2014 Posted November 5, 2014 https://forum.multitheftauto.com/viewtopic.php?f=91&t=78826 ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now