daffabahy Posted February 28, 2016 Share Posted February 28, 2016 [03:16:27] ERROR: [DayZ-MTA]/DayZ/survivorSystem.lua:384: attempt to index globa l 'elementWeaponBack' (a nil value) [03:19:12] ERROR: [DayZ-MTA]/DayZ/survivorSystem.lua:508: attempt to index globa l 'elementWeaponBack' (a nil value) [03:20:20] ERROR: [DayZ-MTA]/DayZ/survivorSystem.lua:495: attempt to index globa l 'elementWeaponBack' (a nil value) Can you help me fix the error scripts ? pls help me. this the full function code. 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]") detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end end addEventHandler("onPlayerWeaponSwitch", getRootElement(), weaponSwitchBack) function removeBackWeaponOnDrop() if elementWeaponBack[source] then detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end end addEvent("removeBackWeaponOnDrop", true) addEventHandler("removeBackWeaponOnDrop", getRootElement(), removeBackWeaponOnDrop) function removeAttachedOnDeath() if elementBackpack[source] then detachElementFromBone(elementBackpack[source]) destroyElement(elementBackpack[source]) end if elementWeaponBack[source] then detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end end Link to comment
EstrategiaGTA Posted February 28, 2016 Share Posted February 28, 2016 Where is elementWeaponBack defined? Link to comment
GonzaloBuenosAires Posted August 25, 2017 Share Posted August 25, 2017 elseif currentWeaponID == weapID1 then detachElementFromBone(elementWeaponBack[source]) if isElement ( elementWeaponBack [ source ] ) then destroyElement ( elementWeaponBack [ source ] ) end elementWeaponBack[source] = false end end Copy and paste, and fixing ... 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