Update fn_fillTurrets to prevent out of index error

This commit is contained in:
A Man
2022-06-04 11:18:23 +02:00
parent 3296109593
commit 87dd340176

View File

@@ -31,9 +31,10 @@ local _findRecurse = {
if (!(["Horn",_type] call fnc_inString) && (_type != "")) then { if (!(["Horn",_type] call fnc_inString) && (_type != "")) then {
local _turret = _x select 1; local _turret = _x select 1;
local _mags = getArray(configFile >> "CfgWeapons" >> _type >> "magazines"); local _mags = getArray(configFile >> "CfgWeapons" >> _type >> "magazines");
local _mag = _mags select 0;
if (!isNil "_mag")then { if (count _mags > 0) then {
local _mag = _mags select 0;
for "_i" from 1 to _countMags do { for "_i" from 1 to _countMags do {
_obj addMagazineTurret[_mag,_turret]; _obj addMagazineTurret[_mag,_turret];
}; };
@@ -46,9 +47,10 @@ local _findRecurse = {
if !(["Horn",_weapon] call fnc_inString) then { if !(["Horn",_weapon] call fnc_inString) then {
local _mags = getArray(configFile >> "CfgWeapons" >> _weapon >> "magazines"); local _mags = getArray(configFile >> "CfgWeapons" >> _weapon >> "magazines");
local _mag = _mags select 0;
if (!isNil "_mag")then { if (count _mags > 0) then {
local _mag = _mags select 0;
for "_i" from 1 to _countMags do { for "_i" from 1 to _countMags do {
_obj addMagazine _mag; _obj addMagazine _mag;
}; };