Miika Posted July 10, 2015 Share Posted July 10, 2015 (edited) Hi, My mod downloader script replaces only first item from table. This is part of my script: ------{CLIENT}------ [Table] modTable = { --{"Name", "example.txd", "example.dff", "vehicle id", "vehicle to replace"} {"Chevrolet Corvette Sport", "mods/euros.txd", "mods/euros.dff", 587, "Euros"}, {"Nissan Micra 2011 Stance Itasha", "mods/peren.txd", "mods/peren.dff", 404, "Perennial"} } [Replace function] function applymods() local num = 0 for k, v in ipairs (modTable) do local num = num + 1 if (modTable[num]) then if (fileExists(modTable[num][2])) and (fileExists(modTable[num][3])) then -- I have all mods in client folder txd = engineLoadTXD(modTable[num][2]) engineImportTXD(txd, modTable[num][4]) dff = engineLoadDFF(modTable[num][3]) engineReplaceModel(dff, modTable[num][4]) end end end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), applymods) addEventHandler("onClientFileDownloadComplete", getResourceRootElement(getThisResource()), applymods) No any errors in debugscript Edited July 11, 2015 by Guest Link to comment
GTX Posted July 10, 2015 Share Posted July 10, 2015 function applymods() for num=1, #modTable do if (modTable[num]) then if (fileExists(modTable[num][2])) and (fileExists(modTable[num][3])) then -- I have all mods in client folder txd = engineLoadTXD(modTable[num][2]) engineImportTXD(txd, modTable[num][4]) dff = engineLoadDFF(modTable[num][3]) engineReplaceModel(dff, modTable[num][4]) end end end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), applymods) Link to comment
Miika Posted July 11, 2015 Author Share Posted July 11, 2015 Thanks GTX, it's working perfectly! Link to comment
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