harib Posted August 24, 2013 Share Posted August 24, 2013 Hola, me podrían ayudar a solucionar este error? 435: Bad argument @ 'setElementID' [Expected element at argument 1, got nil] 437: Bad argument @ 'destroyElement' [Expected element at argument 1, got nil] El código que da problema: elseif currentWeaponID == weapID1 then setElementID(player, "elementWeaponBack[source]") -- PRUEBA ELIMINAR ERROR detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) -- PRUEBA ELIMINAR ERROR elementWeaponBack[source] = false end El código de esa función entero: function weaponSwitchBack(previousWeaponID, currentWeaponID) local weapon1 = getElementData(source, "currentweapon_1") if not weapon1 then return end local ammoData1, weapID1 = getWeaponAmmoType(weapon1) local x, y, z = getElementPosition(source) local rx, ry, rz = getElementRotation(source) if previousWeaponID == weapID1 then if elementWeaponBack[source] then setElementID(player, "elementWeaponBack[source]") detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end elementWeaponBack[source] = createObject(getWeaponObjectID(weapID1), x, y, z) setObjectScale(elementWeaponBack[source], 0.875) if elementBackpack[source] then attachElementToBone(elementWeaponBack[source], source, 3, 0.19, -0.31, -0.1, 0, 270, -90) else attachElementToBone(elementWeaponBack[source], source, 3, 0.19, -0.11, -0.1, 0, 270, 10) end elseif currentWeaponID == weapID1 then setElementID(player, "elementWeaponBack[source]") -- ESTA ES LA 435 detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) -- ESTA ES LA 437 elementWeaponBack[source] = false end end Gracias! Link to comment
Julian09123 Posted August 25, 2013 Share Posted August 25, 2013 La verdad no entiendo? Porque Dice [source] no es (source) setElementID(player, "elementWeaponBack[source]") -- PRUEBA ELIMINAR ERROR detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) -- PRUEBA ELIMINAR ERROR elementWeaponBack[source] = false Prueba con setElementID(player, elementWeaponBack(source)) -- PRUEBA ELIMINAR ERROR detachElementFromBone(elementWeaponBack(source)) destroyElement(elementWeaponBack(source)) -- PRUEBA ELIMINAR ERROR elementWeaponBack(source) = false Link to comment
Alexs Posted August 25, 2013 Share Posted August 25, 2013 La verdad no entiendo? Porque Dice [source] no es (source) 'elementWeaponBack' debe ser una tabla con esta estructura: { jugador = elemento } Entonces, con 'elementWeaponBack[jugador]' consigues 'elemento'. Link to comment
harib Posted August 25, 2013 Author Share Posted August 25, 2013 Entonces como puedo arreglarlo? Gracias Link to comment
Recommended Posts