_unit = _this select 1;
#define NEW_WEAP "Strela"
#define NEW_WEAP_MAG "Strela"
#define MAX_WEAP_ALLOWED 1
#define UNITS_ARRAY [rus1,rus2,rus3,rus4,rus5,rus6,rus7,rus8,rus9,rus10,rus11,rus12,rus13,rus14,rus15,rus16]
#define UNIT_CLASS "AA"
/*
NEW_WEAP is the weapon you are checking against and adding
NEW_WEAP_MAG is the weapons magazines that you will be adding
MAX_WEAP_ALLOWED is the weapons maximum amount in UNITS_ARRAY
UNITS_ARRAY is the array of units you've placed and are checking against.
*/
if (({ _x hasweapon NEW_WEAP } count UNITS_ARRAY) >= MAX_WEAP_ALLOWED) then
{
_unit groupchat format["%1, MAXIMUM COUNT OF %2 CLASS. CHOOSE ANOTHER", name _unit, UNIT_CLASS];
}
else
{
removeAllWeapons _unit;
/*
Everything below this line was Missing semi - column (;)
I also added the macro from above to make modification easier.
If this is launched via an action, actions are local and hence the other players would not see the sidechat anyway.
*/
_unit groupchat format["%1, TAKING %2 CLASS", name _unit, UNIT_CLASS];
_unit addMagazine NEW_WEAP_MAG;
_unit addMagazine NEW_WEAP_MAG;
_unit addWeapon NEW_WEAP;
_unit addMagazine "8Rnd_9x18_Makarov";
_unit addMagazine "8Rnd_9x18_Makarov";
_unit addMagazine "8Rnd_9x18_Makarov";
_unit addMagazine "8Rnd_9x18_Makarov";
_unit addMagazine "8Rnd_9x18_Makarov";
_unit addMagazine "8Rnd_9x18_Makarov";
_unit addMagazine "8Rnd_9x18_Makarov";
_unit addMagazine "8Rnd_9x18_Makarov";
_unit addWeapon "Makarov";
_unit addWeapon "Binocular";
_unit addWeapon "NVGoggles";
};
nil;
/*
The 'exit' command does not work in SQF format style scripts, if you wish to exit the current scope (frame of reference, current curly brackets) use
if (<BOOL STATEMENT) exitwith {<ANY STATEMENTS>}
You also forgot the closing bracket at line 46.
Nil returned; although may not be needed for actions.
*/