NastaseValy Posted July 13, 2016 Share Posted July 13, 2016 Load skin: weaponTXD = {} weaponDFF = {} function loadTheSkins() for i, skin in ipairs(weaponSkinTable) do weaponTXD[i] = engineLoadTXD(":DayZ/models/weapons/txd/"..skin[1]..".txd") weaponDFF[i] = engineLoadDFF(":DayZ/models/weapons/dff/"..skin[1]..".dff", 0) end end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),loadTheSkins) ERROR: [DayZ-Mod]/dayz/loadskin.lua:5: bad argument #1 to 'ipairs' (table expected, got nil) Replace model: local loaded = false function onClientPlayerSkinChange(prevSlot,newSlot) local getSlot = getPedWeaponSlot(localPlayer) if newSlot == 0 then loaded = false elseif newSlot == 3 then if getElementData(localPlayer,"currentweapon_1") == "DMR" then if not loaded then engineImportTXD(weaponTXD[1], 358) engineReplaceModel(weaponDFF[1],358) loaded = true else return end elseif getElementData(localPlayer,"currentweapon_1") == "SVD Camo" then if not loaded then engineImportTXD(weaponTXD[2], 358) engineReplaceModel(weaponDFF[2],358) loaded = true else return end else engineRestoreModel(358) loaded = false addEventHandler("onClientPlayerWeaponSwitch",localPlayer,onClientPlayerSkinChange) ERROR: Loading script falied: [DayZ-Mod]/dayz/replacemodel.lua:27: 'end' expected (to close 'if' at line near '' Link to comment
Tekken Posted July 13, 2016 Share Posted July 13, 2016 First error simply says that there is no table named weaponSkinTable and the second one tells you to add an end after loaded = false. Link to comment
NastaseValy Posted July 13, 2016 Author Share Posted July 13, 2016 Thank you for Loadskin. but I still give me error replacemodel, i also added an end as you said local loaded = false function onClientPlayerSkinChange(prevSlot,newSlot) local getSlot = getPedWeaponSlot(localPlayer) if newSlot == 0 then loaded = false elseif newSlot == 3 then if getElementData(localPlayer,"currentweapon_1") == "DMR" then if not loaded then engineImportTXD(weaponTXD[1], 358) engineReplaceModel(weaponDFF[1],358) loaded = true else return end elseif getElementData(localPlayer,"currentweapon_1") == "SVD Camo" then if not loaded then engineImportTXD(weaponTXD[2], 358) engineReplaceModel(weaponDFF[2],358) loaded = true else return end else engineRestoreModel(358) loaded = false end addEventHandler("onClientPlayerWeaponSwitch",localPlayer,onClientPlayerSkinChange) ERROR: Loading script falied: [DayZ-Mod]/dayz/replacemodel.lua:28: 'end' expected (to close 'if' at line 5) near '' Link to comment
Walid Posted July 13, 2016 Share Posted July 13, 2016 Try this one : local loaded = false function onClientPlayerSkinChange(prevSlot,newSlot) local getSlot = getPedWeaponSlot(localPlayer) if newSlot == 0 then loaded = false elseif newSlot == 3 then if getElementData(localPlayer,"currentweapon_1") == "DMR" then if not loaded then engineImportTXD(weaponTXD[1], 358) engineReplaceModel(weaponDFF[1],358) loaded = true else return end elseif getElementData(localPlayer,"currentweapon_1") == "SVD Camo" then if not loaded then engineImportTXD(weaponTXD[2], 358) engineReplaceModel(weaponDFF[2],358) loaded = true else return end else engineRestoreModel(358) loaded = false end end end addEventHandler("onClientPlayerWeaponSwitch",localPlayer,onClientPlayerSkinChange) Link to comment
NastaseValy Posted July 13, 2016 Author Share Posted July 13, 2016 THX! And here? weaponSkinTable = { {"dmr",1,"DMR"}, {"svdcamo",1,"SVD Camo"}, } weaponTXD = {} weaponDFF = {} function loadTheSkins() for i, skin in ipairs(weaponSkinTable) do weaponTXD[i] = engineLoadTXD(":DayZ/models/weapons/txd/"..skin[1]..".txd") weaponDFF[i] = engineLoadDFF(":DayZ/models/weapons/dff/"..skin[1]..".dff", 0) end end end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),loadTheSkins) ERROR: Loading script failed: [DayZ-Mod]/dayz/loadskin.lua:15: '' expected near 'end' Link to comment
Walid Posted July 13, 2016 Share Posted July 13, 2016 ERROR: Loading script failed: [DayZ-Mod]/dayz/loadskin.lua:15: '' expected near 'end' local weaponSkinTable = { {"dmr",1,"DMR"}, {"svdcamo",1,"SVD Camo"}, } local weaponTXD = {} local weaponDFF = {} function loadTheSkins() for i, skin in pairs(weaponSkinTable) do weaponTXD[i] = engineLoadTXD(":DayZ/models/weapons/txd/"..skin[1]..".txd") weaponDFF[i] = engineLoadDFF(":DayZ/models/weapons/dff/"..skin[1]..".dff", 0) end end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),loadTheSkins) Link to comment
NastaseValy Posted July 13, 2016 Author Share Posted July 13, 2016 Thanks a lot, no error, but why do I load the weapon skins? Link to comment
Walid Posted July 13, 2016 Share Posted July 13, 2016 Thanks a lot, no error, but why do I load the weapon skins? I don't know. Try using outputDebugString to see what the problem is. Link to comment
NastaseValy Posted July 13, 2016 Author Share Posted July 13, 2016 I have added some new weapons and SVD DMR. We solved all their bugs, but when I load a weapon skin (CZ, DMR, SVD) put the same skin on all three weapons. What is the problem? 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