Jump to content

Mokey II

Counting Rockets, deleting, re-adding amount

Recommended Posts

So on my server I run a script that allows players to access virtual arsenal before spawn. I have made/modified a script to limit the amount of ammo they can have after spawning. 


So currently, it removes all ammo for guns, then re-adds the ammo to their inventory. This is to stop outside loadouts from VA to be used without disabling loading of VA. So it limits magazine count. 

My issue is, I can't seem to figure out the same method for rockets and rockets only. Anyone point me in the right direction?

private _var = player;

Fn_Gear_CompatibleMagazines =
{
	private _cls = configFile >> "CfgWeapons" >> _this;
	private _res = [];
	{
		_res pushBack (if (_x == "this")
		then {getArray(_cls >> "magazines")}
		else {getArray(_cls >> _x >> "magazines")});
	} forEach getArray(_cls >> "muzzles");

	_res
};

{
	if (count _x > 0) then
	{
		while {count _x > 0} do {
			{
			    if (count _x > 0) then
			    	{
					_var removeMagazine (_x select 0)
				}
			} foreach (_x call Fn_Gear_CompatibleMagazines)
		}
	}

} forEach [primaryWeapon _var, secondaryWeapon _var, handgunWeapon _var];

{
	if (count _x > 0) then
	{
		{
			if (count _x > 0) then
			{
				_var addMagazines [(_x select 0), 2]
			}
		} foreach (_x call Fn_Gear_CompatibleMagazines)
	}
} forEach [primaryWeapon _var, secondaryWeapon _var, handgunWeapon _var];

 

Share this post


Link to post
Share on other sites

So I was thinking of something along the lines of this:

 

private _var = player;
_equippedRocket = [
			"launch_RPG7_F",
			"launch_RPG32_F",
			"launch_RPG32_ghex_F",
			"launch_NLAW_F",
			"launch_MRAWS_green_rail_F",
			"launch_MRAWS_olive_rail_F",
			"launch_MRAWS_sand_rail_F",
			"launch_MRAWS_green_F",
			"launch_MRAWS_olive_F",
			"launch_MRAWS_sand_F",
			"launch_O_Vorona_brown_F",
			"launch_O_Vorona_green_F",
			"launch_Titan_short_F",
			"launch_O_Titan_short_F",
			"launch_I_Titan_short_F",
			"launch_B_Titan_short_tna_F",
			"launch_O_Titan_short_ghex_F",
			"launch_Titan_F",
			"launch_O_Titan_F",
			"launch_I_Titan_F",
			"launch_B_Titan_tna_F",
			"launch_O_Titan_ghex_F"
                  ];

{
	_var selectWeapon _equippedRocket;

	if (currentWeapon _var == _equippedRocket) then
	{
		_var removeMagazine currentWeapon;
		_var addMagazine currentWeapon (_x select 0);
	}
}

given it doesn't work,  I'm essentially swinging in the dark now.

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

×