velcan1 Posted August 12, 2011 Share Posted August 12, 2011 Hi all, Im here to ask for help with a wheel replacement script, Im not sure why it wont work, its suposed to be working fine... local wheelDFFS = { {"wheel_1", 1025}, {"wheel_2", 1073}, {"wheel_3", 1074}, {"wheel_4", 1075}, {"wheel_5", 1076}, {"wheel_6", 1077}, {"wheel_7", 1078}, {"wheel_8", 1079}, {"wheel_9", 1080}, {"wheel_10", 1081}, {"wheel_11", 1082}, {"wheel_12", 1083}, {"wheel_13", 1084}, {"wheel_14", 1085}, {"wheel_15", 1096}, {"wheel_16", 1097}, {"wheel_17", 1098}, } addEventHandler("onClientResourceStart",resourceRoot, function () for index, dff in pairs(wheelDFFS) do local thedff = engineLoadDFF("wheels/".. tostring(dff[1]) ..".dff", tonumber(dff[2])) engineReplaceModel(thedff, tonumber(dff[2])) end local txd = engineLoadTXD("wheels/wheels.txd") engineImportTXD(txd, 1025) end) If someone can help me please. Link to comment
Kenix Posted August 12, 2011 Share Posted August 12, 2011 wheelDFFS = { {"wheel_1", 1025}, {"wheel_2", 1073}, {"wheel_3", 1074}, {"wheel_4", 1075}, {"wheel_5", 1076}, {"wheel_6", 1077}, {"wheel_7", 1078}, {"wheel_8", 1079}, {"wheel_9", 1080}, {"wheel_10", 1081}, {"wheel_11", 1082}, {"wheel_12", 1083}, {"wheel_13", 1084}, {"wheel_14", 1085}, {"wheel_15", 1096}, {"wheel_16", 1097}, {"wheel_17", 1098}, } addEventHandler("onClientResourceStart",resourceRoot, function () for index, dff in pairs(wheelDFFS) do local thedff = engineLoadDFF("wheels/".. dff[1] ..".dff", dff[2]) engineReplaceModel(thedff, dff[2]) end local txd = engineLoadTXD("wheels/wheels.txd") engineImportTXD(txd, 1025) end) Link to comment
velcan1 Posted August 12, 2011 Author Share Posted August 12, 2011 I dont know if thats a joke, but what you did was just remove tostring() and tonumber(), they dont affect anything. Link to comment
Kenix Posted August 12, 2011 Share Posted August 12, 2011 (edited) wheelDFFS = { {"wheel_1", 1025}, {"wheel_2", 1073}, {"wheel_3", 1074}, {"wheel_4", 1075}, {"wheel_5", 1076}, {"wheel_6", 1077}, {"wheel_7", 1078}, {"wheel_8", 1079}, {"wheel_9", 1080}, {"wheel_10", 1081}, {"wheel_11", 1082}, {"wheel_12", 1083}, {"wheel_13", 1084}, {"wheel_14", 1085}, {"wheel_15", 1096}, {"wheel_16", 1097}, {"wheel_17", 1098}, } addEventHandler("onClientResourceStart",resourceRoot, function () for index, dff in pairs(wheelDFFS) do local thedff = engineLoadDFF("wheels/".. dff[1] ..".dff", 0) engineReplaceModel(thedff, dff[2]) end local txd = engineLoadTXD("wheels/wheels.txd") engineImportTXD(txd, 1025) end) Edited August 12, 2011 by Guest Link to comment
DiSaMe Posted August 12, 2011 Share Posted August 12, 2011 Kenix, you're wrong. engineLoadDFF documentation says second argument must be 0 when replacing something else than vehicle. Link to comment
Kenix Posted August 12, 2011 Share Posted August 12, 2011 Kenix, you're wrong.engineLoadDFF documentation says second argument must be 0 when replacing something else than vehicle. thx you right.i not see all documentation in my phone Link to comment
velcan1 Posted August 12, 2011 Author Share Posted August 12, 2011 Even when I put 0 it still doesnt work. Link to comment
velcan1 Posted August 12, 2011 Author Share Posted August 12, 2011 The code is still the same as mine but without tostring() and tonumber(). Link to comment
Kenix Posted August 12, 2011 Share Posted August 12, 2011 This should work wheelDFFS = { {"wheel_1", 1025}, {"wheel_2", 1073}, {"wheel_3", 1074}, {"wheel_4", 1075}, {"wheel_5", 1076}, {"wheel_6", 1077}, {"wheel_7", 1078}, {"wheel_8", 1079}, {"wheel_9", 1080}, {"wheel_10", 1081}, {"wheel_11", 1082}, {"wheel_12", 1083}, {"wheel_13", 1084}, {"wheel_14", 1085}, {"wheel_15", 1096}, {"wheel_16", 1097}, {"wheel_17", 1098}, } addEventHandler("onClientResourceStart",resourceRoot, function () for k, i in ipairs(wheelDFFS) do local thedff = engineLoadDFF("wheels/".. tostring(wheelDFFS[k][1]) ..".dff", 0) engineReplaceModel(thedff, tonumber(wheelDFFS[k][2])) end local txd = engineLoadTXD("wheels/wheels.txd") engineImportTXD(txd, 1025) end) Link to comment
Castillo Posted August 12, 2011 Share Posted August 12, 2011 Kenix, his code is right as far as I can see, the table does his work and the loop too. 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