MyArena Posted February 14, 2017 Share Posted February 14, 2017 Hi all! I'm dont speak English, I use google translate ERROR: [DayZ-MTA]/DayZ/survivorSystem.lua:374: attempt to index global 'elementWeaponRaplace' (a nil value) Function: Spoiler function rearmPlayerWeapon (weaponName,slot) takeAllWeapons (source) local ammoData,weapID = getWeaponAmmoType (weaponName) if getElementData(source,ammoData) <= 0 then triggerClientEvent (source, "displayClientInfo", source,"Rearm",shownInfos["nomag"],255,22,0) if elementWeaponRaplace[source] then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end return end setElementData(source,"currentweapon_"..slot,weaponName) setElementData ( source, "selectedWeapon",weaponName) if getElementData ( source, "usingGrenadeThrower" ) then toggleControl ( source, 'fire', true ) setElementData ( source, "usingGrenadeThrower", false ) end --Old Weapons local weapon = getElementData(source,"currentweapon_1") if weapon then local quant = tonumber(getElementData ( source, weapon )) local ammoData,weapID = getWeaponAmmoType (weapon) if quant and ammoData and quant > 0 then local ammo = tonumber(getElementData(source,ammoData)) if ammo and ammo > 0 then giveWeapon(source,weapID,getElementData(source,ammoData), false ) end end end local weapon = getElementData(source,"currentweapon_2") if weapon then local quant = tonumber(getElementData ( source, weapon )) local ammoData,weapID = getWeaponAmmoType (weapon) if quant and ammoData and quant > 0 then local ammo = tonumber(getElementData(source,ammoData)) if ammo and ammo > 0 then giveWeapon(source,weapID,getElementData(source,ammoData), false ) end end end local weapon = getElementData(source,"currentweapon_3") if weapon then local quant = tonumber(getElementData ( source, weapon )) local ammoData,weapID = getWeaponAmmoType (weapon) if quant and ammoData and quant > 0 then local ammo = tonumber(getElementData(source,ammoData)) if ammo and ammo > 0 then giveWeapon(source,weapID,getElementData(source,ammoData), false ) end end end end addEvent("onPlayerRearmWeapon",true) addEventHandler("onPlayerRearmWeapon",getRootElement(),rearmPlayerWeapon) Line warning if elementWeaponRaplace[source] then Help remove this warning please! Link to comment
pa3ck Posted February 14, 2017 Share Posted February 14, 2017 Do you have elementWeaponRaplace = {} anywhere in the code? Link to comment
MyArena Posted February 15, 2017 Author Share Posted February 15, 2017 17 hours ago, pa3ck said: Do you have elementWeaponRaplace = {} anywhere in the code? Thank you man! I corrected events by comparing and accidentally threw the extra code in Lua file. Spoiler я исправлял мод путём сравнения и случайно закинул лишний код в lua файл. 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