Tryteyker-
This function only returns the primary muzzle name of a gun. For more info on how to select guns' secondary muzzle names (like an underhand grenade launcher), view the notes on selectWeapon.
Results appear below as you type; use the arrow keys to move through them.
Adds a weapon to the specified unit, with magazine classnames taken from the weapon's config (in CfgWeapons). This function does not remove magazines nor weapons prior to adding the new weapon, so that still has to be done manually.
[unit, weaponClassName, quantity, type] call BIS_fnc_addWeapon
Parameters:
unit: Object - unit to add weapon to.weaponClassName: String - weapon Classname (found in CfgWeapons).quantity: Number - amount of magazines.type: Number or String - (Optional, default 0)
Returns: String - primary**(!)** muzzle name of weapon.
Add 6 dual-purpose magazines and the underwater gun to the player:
[player, "arifle_SDAR_F", 6] call BIS_fnc_addWeapon;
Adds 2 × 30 Rnd Stanag Tracer (Red) magazines to bluforUnit, with an Mk20_F:
[bluforUnit, "arifle_Mk20_F", 2, 1] call BIS_fnc_addWeapon;
Alternative syntax of second example, with magazine name written out:
[bluforUnit, "arifle_Mk20_F", 2, "30Rnd_556x45_Stanag_Tracer_red"] call BIS_fnc_addWeapon;
This function only returns the primary muzzle name of a gun. For more info on how to select guns' secondary muzzle names (like an underhand grenade launcher), view the notes on selectWeapon.