//==========================================//
//					    //
//	  Do not edit this file		    //
//					    //
//==========================================//


if (isnull player) exitwith {};

sleep 1;

//================================================================

if (ammo_b3_c == "he") then
{
	if (b3_he_ammo_current < 1) then
	{
		out_of_ammo = true;
	}
	else
	{
		if (mission_b3_c == "timed") then
		{
			ammo_cal_he_b3 = duration_b3 / rof_b3;
			sleep 1;
			if (b3_he_ammo_current < ammo_cal_he_b3) then
			{
				duration_b3 = ammo_cal_he_b3;
				publicvariable "duration_b3";
				out_of_ammo2 = true;
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %1 Seconds", duration_b3];
			};
		}
		else
		{
			if (b3_he_ammo_current < duration_b3) then
			{
				duration_b3 = b3_he_ammo_current;
				publicvariable "duration_b3";
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %2 %1 rounds", ammo_b3_c, duration_b3];
			};
			if (b3_he_ammo_current <= duration_b3) then
			{
				out_of_ammo2 = true;
			};
		};
	};
};


//====================================================================

if (ammo_b3_c == "illum") then
{
	if (b3_illum_ammo_current < 1) then
	{
		out_of_ammo = true;
	}
	else
	{
		if (mission_b3_c == "timed") then
		{
			ammo_cal_illum_b3 = duration_b3 / rof_b3;
			sleep 1;
			if (b3_illum_ammo_current < ammo_cal_illum_b3) then
			{
				duration_b3 = ammo_cal_illum_b3;
				publicvariable "duration_b3";
				out_of_ammo2 = true;
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %1 Seconds", duration_b3];
			};
		}
		else
		{
			if (b3_illum_ammo_current < duration_b3) then
			{
				duration_b3 = b3_illum_ammo_current;
				publicvariable "duration_b3";
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %2 %1 rounds", ammo_b3_c, duration_b3];
			};
			if (b3_illum_ammo_current <= duration_b3) then
			{
				out_of_ammo2 = true;
			};
		};
	};
};


//====================================================================

if (ammo_b3_c == "wp") then
{
	if (b3_wp_ammo_current < 1) then
	{
		out_of_ammo = true;
	}
	else
	{
		if (mission_b3_c == "timed") then
		{
			ammo_cal_wp_b3 = duration_b3 / rof_b3;
			sleep 1;
			if (b3_wp_ammo_current < ammo_cal_wp_b3) then
			{
				duration_b3 = ammo_cal_wp_b3;
				publicvariable "duration_b3";
				out_of_ammo2 = true;
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %1 Seconds", duration_b3];
			};
		}
		else
		{
			if (b3_wp_ammo_current < duration_b3) then
			{
				duration_b3 = b3_wp_ammo_current;
				publicvariable "duration_b3";
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %2 %1 rounds", ammo_b3_c, duration_b3];
			};
			if (b3_wp_ammo_current <= duration_b3) then
			{
				out_of_ammo2 = true;
			};
		};
	};
};


//====================================================================

if (ammo_b3_c == "laser") then
{
	if (b3_laser_ammo_current < 1) then
	{
		out_of_ammo = true;
	}
	else
	{
		if (mission_b3_c == "timed") then
		{
			ammo_cal_laser_b3 = duration_b3 / rof_b3;
			sleep 1;
			if (b3_laser_ammo_current < ammo_cal_laser_b3) then
			{
				duration_b3 = ammo_cal_laser_b3;
				publicvariable "duration_b3";
				out_of_ammo2 = true;
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %1 Seconds", duration_b3];
			};
		}
		else
		{
			if (b3_laser_ammo_current < duration_b3) then
			{
				duration_b3 = b3_laser_ammo_current;
				publicvariable "duration_b3";
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %2 %1 rounds", ammo_b3_c, duration_b3];
			};
			if (b3_laser_ammo_current <= duration_b3) then
			{
				out_of_ammo2 = true;
			};
		};
	};
};


//====================================================================

if (ammo_b3_c == "sadarm") then
{
	if (b3_sadarm_ammo_current < 1) then
	{
		out_of_ammo = true;
	}
	else
	{
		if (mission_b3_c == "timed") then
		{
			ammo_cal_sadarm_b3 = duration_b3 / rof_b3;
			sleep 1;
			if (b3_sadarm_ammo_current < ammo_cal_sadarm_b3) then
			{
				duration_b3 = ammo_cal_sadarm_b3;
				publicvariable "duration_b3";
				out_of_ammo2 = true;
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %1 Seconds", duration_b3];
			};
		}
		else
		{
			if (b3_sadarm_ammo_current < duration_b3) then
			{
				duration_b3 = b3_sadarm_ammo_current;
				publicvariable "duration_b3";
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %2 %1 rounds", ammo_b3_c, duration_b3];
			};
			if (b3_sadarm_ammo_current <= duration_b3) then
			{
				out_of_ammo2 = true;
			};
		};
	};
};


//====================================================================

if (ammo_b3_c == "smoke") then
{
	if (b3_smoke_ammo_current < 1) then
	{
		out_of_ammo = true;
	}
	else
	{
		if (mission_b3_c == "timed") then
		{
			ammo_cal_smoke_b3 = duration_b3 / rof_b3;
			sleep 1;
			if (b3_smoke_ammo_current < ammo_cal_smoke_b3) then
			{
				duration_b3 = ammo_cal_smoke_b3;
				publicvariable "duration_b3";
				out_of_ammo2 = true;
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %1 Seconds", duration_b3];
			};
		}
		else
		{
			if (b3_smoke_ammo_current < duration_b3) then
			{
				duration_b3 = b3_smoke_ammo_current;
				publicvariable "duration_b3";
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %2 %1 rounds", ammo_b3_c, duration_b3];
			};
			if (b3_smoke_ammo_current <= duration_b3) then
			{
				out_of_ammo2 = true;
			};
		};
	};
};


//====================================================================