Miika Posted July 10, 2015 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 Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
GTX Posted July 10, 2015 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) Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
Miika Posted July 11, 2015 Author Posted July 11, 2015 Thanks GTX, it's working perfectly! Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
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