DMS_Exile/@ExileServer/addons/a3_dms/scripts/fn_AddWeapon.sqf

55 lines
1.2 KiB
Plaintext
Raw Normal View History

2016-06-20 21:12:06 +00:00
/*
DMS_fnc_AddWeapon
created by eraser1 - based off of BIS_fnc_AddWeapon
2016-06-28 00:07:18 +00:00
https://github.com/Defent/DMS_Exile/wiki/DMS_fnc_AddWeapon
2016-06-20 21:12:06 +00:00
Description:
Add a weapon to a unit with the right magazines. Magazine class is obtained from the weapon's config.
Usage:
[
2016-06-28 00:07:18 +00:00
_unit, // <object> The unit that is to receive the weapon (and magazines).
_weapon, // <string> The classname of the weapon to be added.
_magazineCount, // <scalar> Number of magazines to be added.
_magClassname // <string> (Optional) The classname of the magazine to be added.
2016-06-20 21:12:06 +00:00
] call DMS_fnc_AddWeapon;
Nothing is returned
*/
if (params
[
"_unit",
"_weapon",
"_magazineCount"
])
then
{
//Add magazines
if (_magazineCount > 0) then
{
private _magazine =
if ((count _this) > 3) then
{
_this select 3
}
else
{
2016-07-06 00:16:06 +00:00
_weapon call DMS_fnc_selectMagazine
2016-06-20 21:12:06 +00:00
};
for "_i" from 1 to _magazineCount do
{
_unit addMagazine _magazine;
};
};
//Add weapon
_unit addWeapon _weapon;
}
else
{
diag_log format["DMS ERROR :: Calling DMS_fnc_AddWeapon with invalid parameters: %1",_this];
};