Jump to content
Sign in to follow this  
dcthehole

Select a weapon from arrays

Recommended Posts

What I'm trying to do is select a the in-hand weapon and convert it to its equivalent silenced form. Any suggestions?

Share this post


Link to post
Share on other sites
private["_curWep","_siWep","_canConvert"];

WeaponArray =
[
["M4", "M4_SD"],
["M9", "M9_SD"]
];

_curWep = currentWeapon player;
_siWep = "";
_canConvert = false;

for [{_i = 0},{_i < count WeaponArray},{_i = _i + 1}] do
{
if (_curWep == ((WeaponArray select _i) select 0)) then
{
	_siWep = ((WeaponArray select _i) select 1);
	_canConvert = true;
};
};

if (_canConvert) then
{
player removeWeapon _curWep;
player addWeapon _siWep;
player selectWeapon _siWep;
};

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×