; exit script 04 AMMO LOW


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


; Truck alive?

xx = deleteStatus "04Truck";
GLB_04_TRUCK = false;
? canmove Truck : GLB_04_TRUCK = true; xx = Truck saveStatus "04Truck";
SaveVar "GLB_04_TRUCK";


; Saving soldiers - player's group

GLB_04_HOWMANY = 0;
? count units group aP == 5 : GLB_04_HOWMANY = 1;
? count units group aP < 5 : GLB_04_HOWMANY = 2;
saveVar "GLB_04_HOWMANY";

; Special soldiers
? alive aMed : GLB_04_MED = true; saveVar "GLB_04_MED"; xx = aMed saveStatus "04Medic";

; ------- Player's group ---------

_i = count units group aP;
_j = 0;
_k = 0;
_Mis = "04";
_Out = [aMed, aP];

#LOOP
? _j >= _i : goto "Next"

? ((units group aP) select _j) in _Out : goto "SKIP"
? alive ((units group aP) select _j) : xx = ((units group aP) select _j) saveStatus _Mis + (format ["Sold%1", _k]); _k = _k+1;

#SKIP
_j = _j + 1;
goto "LOOP"

#Next
GLB_04_NUMBER = _k; saveVar "GLB_04_NUMBER";


; ================== WEAPON POOL ====================

addWeaponPool ["AK47CZ", 4];
addMagazinePool ["AK47", 30];

; From Ammo Crate
pickWeaponPool Bedna;
pickWeaponPool Truck; clearWeaponCargo Truck; clearMagazineCargo Truck;

; Stolen cars
GLB_TR = 0;

_tr1 = false;
? side (driver Am) == resistance : _tr1 = true;
? alive Am and (driver Am != driver Am) and ((Am distance aP) < 250) : _tr1 = true;

? _tr1 : pickWeaponPool Am; clearWeaponCargo Am; clearMagazineCargo Am; GLB_TR = GLB_TR + 1

_tr2 = false;
? side (driver Ur) == resistance : _tr2 = true;
? alive Ur and (driver Ur != driver Ur) and ((Ur distance aP) < 250) : _tr2 = true;

? _tr2 : pickWeaponPool Ur; clearWeaponCargo Ur; clearMagazineCargo Ur; GLB_TR = GLB_TR + 1

saveVar "GLB_TR";



; ------------- END -------------
