Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private ["_unit", "_attachement", "_actualWeapon", "_evolvingTo", "_type", "_muzzles"];
- if ((_this select 0) != (_this select 1)) exitwith {hintsilent "Nice try, dumbass ;)"};
- _unit = _this select 0;
- _attachement = _this select 3;
- _actualWeapon = primaryWeapon _unit;
- if (!(_attachement in (weapons _unit))) exitwith {hintsilent format ["You don't have %1 in your inventory", _attachement]};
- if (_attachement in (getArray (configFile >> "cfgWeapons" >> _actualWeapon >> "canUseItems"))) then {
- _evolvingTo = getText (configFile >> "cfgWeapons" >> _actualWeapon >> "canAttach" >> _attachement >> "evolvesTo");
- _unit removeWeapon _actualWeapon;
- _unit removeWeapon _attachement;
- _unit addWeapon _evolvingTo;
- if ((primaryWeapon _unit) != "") then {
- _type = primaryWeapon _unit;
- _muzzles = getArray(configFile >> "cfgWeapons" >> _type >> "muzzles");
- if (count _muzzles > 1) then {
- _unit selectWeapon (_muzzles select 0);
- } else {
- _unit selectWeapon _type;
- };
- };
- } else {
- hintsilent format ["You can't use %1 on your %2", _attachement, _actualWeapon];
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement