; exit script 17 Offensive


; Saving player's status
aa = aP saveStatus "17Player";
; Player will be saved


; Player's group weapons to weapon pool

_u = 1;
_end = count units group player;
_gr = units group player;

#LOOPGrupa
? _u >= _end : goto "ENDGrupa"

_man = _gr select _u;
_i = 0;

#LPWeap

addWeaponPool [((weapons _man) select _i), 1];
_i = _i + 1;
? _i < (count weapons _man) : goto "LPWeap"

_i = 0;

#LPMag

addMagazinePool [((magazines _man) select _i), 1];
_i = _i + 1;
? _i < (count magazines _man) : goto "LPMag"

_u = _u + 1;
goto "LOOPGrupa";

#ENDGrupa


; ================== BEGIN: WEAPON POOL ====================

#POOL

; Added by mission designer


; Weapon holders stolen?

_vehs = [RT1, RT2, RT3, RT4];
; These vehicles will add their weapons to pool if they are close enough

_a = 0;
_b = count units group aP;

; Add all group vehicles to _vehs
#LOOPGroupVeh

? _b >= _a : goto "ENDGroupVeh"

_who = (units group aP) select _a;
? (vehicle _who != _who) and not ((vehicle _who) in _vehs) : _vehs = _vehs + [vehicle _who];

_a = _a + 1;
goto "LOOPGroupVeh";

#ENDGroupVeh

_a = 0;
_b = count _vehs;

#LOOPHolders
? _a >= _b : goto "ENDHolders"

_work = false;
_u = _vehs select _a
? side (driver _u) == resistance : _work = true;
? alive _u and (driver _u != driver _u) and ((_u distance aP) < 300) : _work = true;

? _work : pickWeaponPool (vehicle _u); clearWeaponCargo (vehicle _u); clearMagazineCargo (vehicle _u);

_a = _a + 1;
goto "LOOPHolders"

#ENDHolders

; ================== END: WEAPON POOL ====================

