
function get_MP5_pieces(items, result, player)
	local Inventory = player:getInventory();
	Inventory:AddItem("QS.MP5Mag");
	local player = getPlayer();
	player:playSound("QSDisassemblePistol", false);
end

function play_assembling_gun(items, result, player)
	local player = getPlayer();
	player:playSound("QSAssemblePistol", false);
end

function QSDistr(_roomName, _containerType, _containerFilled)
	local diff = ReloadManager[1]:getDifficulty();
	local quantity = 0
	local quantity1 = 0
	if _roomName == "all" and _containerType == "inventorymale" then
		if rnd(1000) >= 960 then
			if rnd(10) < 8 then
				if rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableCom);
					local item = CivSMGTableCom[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Body")
					quantity = rnd(15)
					if rnd(10) >= 9 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGCAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGCAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
					if rnd(10) >= 9 then
						if rnd(10) >= 9 then
							_containerFilled:AddItem(CSMGCBoxTable2[GunIndex]);
						else
							_containerFilled:AddItem(CSMGCBoxTable[GunIndex]);
						end
					end
					if diff >= 2 then
						if rnd(10) >= 7 then
							quantity = rnd(2)
							if CSMGCMagTable[GunIndex] ~= "" then
								while quantity ~=0 do
									local item = CSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Body")
									quantity = quantity-1
								end
							end
						end
					end
				elseif rnd (10) < 8 then 
					GunIndex = rnd(#CivSMGTableRare);
					local item = CivSMGTableRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Body")
					quantity = rnd(15)
					if rnd(10) >= 9 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGRAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGRAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
					if rnd(10) >= 9 then
						if rnd(10) >= 9 then
							_containerFilled:AddItem(CSMGRBoxTable2[GunIndex]);
						else
							_containerFilled:AddItem(CSMGRBoxTable[GunIndex]);
						end
					end
					if diff >= 2 then
						if rnd(10) >= 7 then
							quantity = rnd(2)
							if CSMGRMagTable[GunIndex] ~= "" then
								while quantity ~=0 do
									local item = CSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Body")
									quantity = quantity-1
								end
							end
						end
					end
				else
					GunIndex = rnd(#CivSMGTableSuperRare);
					local item = CivSMGTableSuperRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Body")
					quantity = rnd(15)
					if rnd(10) >= 9 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGSRAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGSRAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
					if rnd(10) >= 9 then
						if rnd(10) >= 9 then
							_containerFilled:AddItem(CSMGSRBoxTable2[GunIndex]);
						else
							_containerFilled:AddItem(CSMGSRBoxTable[GunIndex]);
						end
					end
					if diff >= 2 then
						if rnd(10) >= 7 then
							quantity = rnd(2)
							if CSMGSRMagTable[GunIndex] ~= "" then
								while quantity ~=0 do
									local item = CSMGSRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Body")
									quantity = quantity-1
								end
							end
						end
					end		
				end
			else
				if rnd (10) < 7 then
					if rnd (10) < 8 then
						GunIndex = rnd(#PolSMGTableCom);
						local item = PolSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Body")
						quantity = rnd(15)
						if rnd(10) >= 9 then
							while quantity ~=0 do
								_containerFilled:AddItem(PSMGCAmmoTable2[GunIndex]);
								quantity = quantity-1
							end
						else
							while quantity ~=0 do
								_containerFilled:AddItem(PSMGCAmmoTable[GunIndex]);
								quantity = quantity-1
							end
						end
						if rnd(10) >= 9 then
							if rnd(10) >= 9 then
								_containerFilled:AddItem(PSMGCBoxTable2[GunIndex]);
							else
								_containerFilled:AddItem(PSMGCBoxTable[GunIndex]);
							end
						end
						if diff >= 2 then
							if rnd(10) >= 7 then
								quantity = rnd(2)
								if PSMGCMagTable[GunIndex] ~= "" then
									while quantity ~=0 do
										local item = PSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Body")
										quantity = quantity-1
									end
								end
							end
						end
					else
						GunIndex = rnd(#PolSMGTableRare);
						local item = PolSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Body")
						quantity = rnd(15)
						if rnd(10) >= 9 then
							while quantity ~=0 do
								_containerFilled:AddItem(PSMGRAmmoTable2[GunIndex]);
								quantity = quantity-1
							end
						else
							while quantity ~=0 do
								_containerFilled:AddItem(PSMGRAmmoTable[GunIndex]);
								quantity = quantity-1
							end
						end
						if rnd(10) >= 9 then
							if rnd(10) >= 9 then
								_containerFilled:AddItem(PSMGRBoxTable2[GunIndex]);
							else
								_containerFilled:AddItem(PSMGRBoxTable[GunIndex]);
							end
						end
						if diff >= 2 then
							if rnd(10) >= 7 then
								quantity = rnd(2)
								if PSMGRMagTable[GunIndex] ~= "" then
									while quantity ~=0 do
										local item = PSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Body")
										quantity = quantity-1
									end
								end
							end
						end
					end
				else
					if rnd (10) < 8 then
						GunIndex = rnd(#MilSMGTableCom);
						local item = MilSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Body")
						quantity = rnd(15)
						if rnd(10) >= 9 then
							while quantity ~=0 do
								_containerFilled:AddItem(MSMGCAmmoTable[GunIndex]);
								quantity = quantity-1
							end
						else
							while quantity ~=0 do
								_containerFilled:AddItem(MSMGCAmmoTable[GunIndex]);
								quantity = quantity-1
							end
						end
						if rnd(10) >= 9 then
							if rnd(10) >= 9 then
								_containerFilled:AddItem(MSMGCBoxTable[GunIndex]);
							else
								_containerFilled:AddItem(MSMGCBoxTable[GunIndex]);
							end
						end
						if diff >= 2 then
							if rnd(10) >= 7 then
								quantity = rnd(2)
								if MSMGCMagTable[GunIndex] ~= "" then
									while quantity ~=0 do
										local item = MSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Body")
										quantity = quantity-1
									end
								end
							end
						end
					else
						GunIndex = rnd(#MilSMGTableRare);
						local item = MilSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Body")
						quantity = rnd(15)
						if rnd(10) >= 9 then
							while quantity ~=0 do
								_containerFilled:AddItem(MSMGRAmmoTable2[GunIndex]);
								quantity = quantity-1
							end
						else
							while quantity ~=0 do
								_containerFilled:AddItem(MSMGRAmmoTable[GunIndex]);
								quantity = quantity-1
							end
						end
						if rnd(10) >= 9 then
							if rnd(10) >= 9 then
								_containerFilled:AddItem(MSMGRBoxTable2[GunIndex]);
							else
								_containerFilled:AddItem(MSMGRBoxTable[GunIndex]);
							end
						end
						if diff >= 2 then
							if rnd(10) >= 7 then
								quantity = rnd(2)
								if MSMGRMagTable[GunIndex] ~= "" then
									while quantity ~=0 do
										local item = MSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Body")
										quantity = quantity-1
									end
								end
							end
						end
					end
				end
			end
		end	
	elseif _roomName == "all" and _containerType == "inventoryfemale" then
		if rnd(1000) >= 980 then
			if rnd(10) < 8 then
				if rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableCom);
					local item = CivSMGTableCom[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Body")
					quantity = rnd(15)
					if rnd(10) >= 9 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGCAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGCAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
					if rnd(10) >= 9 then
						if rnd(10) >= 9 then
							_containerFilled:AddItem(CSMGCBoxTable2[GunIndex]);
						else
							_containerFilled:AddItem(CSMGCBoxTable[GunIndex]);
						end
					end
					if diff >= 2 then
						if rnd(10) >= 7 then
							quantity = rnd(2)
							if CSMGCMagTable[GunIndex] ~= "" then
								while quantity ~=0 do
									local item = CSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Body")
									quantity = quantity-1
								end
							end
						end
					end
				elseif rnd (10) < 8 then 
					GunIndex = rnd(#CivSMGTableRare);
					local item = CivSMGTableRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Body")
					quantity = rnd(15)
					if rnd(10) >= 9 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGRAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGRAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
					if rnd(10) >= 9 then
						if rnd(10) >= 9 then
							_containerFilled:AddItem(CSMGRBoxTable2[GunIndex]);
						else
							_containerFilled:AddItem(CSMGRBoxTable[GunIndex]);
						end
					end
					if diff >= 2 then
						if rnd(10) >= 7 then
							quantity = rnd(2)
							if CSMGRMagTable[GunIndex] ~= "" then
								while quantity ~=0 do
									local item = CSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Body")
									quantity = quantity-1
								end
							end
						end
					end
				else
					GunIndex = rnd(#CivSMGTableSuperRare);
					local item = CivSMGTableSuperRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Body")
					quantity = rnd(15)
					if rnd(10) >= 9 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGSRAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGSRAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
					if rnd(10) >= 9 then
						if rnd(10) >= 9 then
							_containerFilled:AddItem(CSMGSRBoxTable2[GunIndex]);
						else
							_containerFilled:AddItem(CSMGSRBoxTable[GunIndex]);
						end
					end
					if diff >= 2 then
						if rnd(10) >= 7 then
							quantity = rnd(2)
							if CSMGSRMagTable[GunIndex] ~= "" then
								while quantity ~=0 do
									local item = CSMGSRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Body")
									quantity = quantity-1
								end
							end
						end
					end		
				end
			else
				if rnd (10) < 7 then
					if rnd (10) < 8 then
						GunIndex = rnd(#PolSMGTableCom);
						local item = PolSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Body")
						quantity = rnd(15)
						if rnd(10) >= 9 then
							while quantity ~=0 do
								_containerFilled:AddItem(PSMGCAmmoTable2[GunIndex]);
								quantity = quantity-1
							end
						else
							while quantity ~=0 do
								_containerFilled:AddItem(PSMGCAmmoTable[GunIndex]);
								quantity = quantity-1
							end
						end
						if rnd(10) >= 9 then
							if rnd(10) >= 9 then
								_containerFilled:AddItem(PSMGCBoxTable2[GunIndex]);
							else
								_containerFilled:AddItem(PSMGCBoxTable[GunIndex]);
							end
						end
						if diff >= 2 then
							if rnd(10) >= 7 then
								quantity = rnd(2)
								if PSMGCMagTable[GunIndex] ~= "" then
									while quantity ~=0 do
										local item = PSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Body")
										quantity = quantity-1
									end
								end
							end
						end
					else
						GunIndex = rnd(#PolSMGTableRare);
						local item = PolSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Body")
						quantity = rnd(15)
						if rnd(10) >= 9 then
							while quantity ~=0 do
								_containerFilled:AddItem(PSMGRAmmoTable2[GunIndex]);
								quantity = quantity-1
							end
						else
							while quantity ~=0 do
								_containerFilled:AddItem(PSMGRAmmoTable[GunIndex]);
								quantity = quantity-1
							end
						end
						if rnd(10) >= 9 then
							if rnd(10) >= 9 then
								_containerFilled:AddItem(PSMGRBoxTable2[GunIndex]);
							else
								_containerFilled:AddItem(PSMGRBoxTable[GunIndex]);
							end
						end
						if diff >= 2 then
							if rnd(10) >= 7 then
								quantity = rnd(2)
								if PSMGRMagTable[GunIndex] ~= "" then
									while quantity ~=0 do
										local item = PSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Body")
										quantity = quantity-1
									end
								end
							end
						end
					end
				else
					if rnd (10) < 8 then
						GunIndex = rnd(#MilSMGTableCom);
						local item = MilSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Body")
						quantity = rnd(15)
						if rnd(10) >= 9 then
							while quantity ~=0 do
								_containerFilled:AddItem(MSMGCAmmoTable[GunIndex]);
								quantity = quantity-1
							end
						else
							while quantity ~=0 do
								_containerFilled:AddItem(MSMGCAmmoTable[GunIndex]);
								quantity = quantity-1
							end
						end
						if rnd(10) >= 9 then
							if rnd(10) >= 9 then
								_containerFilled:AddItem(MSMGCBoxTable[GunIndex]);
							else
								_containerFilled:AddItem(MSMGCBoxTable[GunIndex]);
							end
						end
						if diff >= 2 then
							if rnd(10) >= 7 then
								quantity = rnd(2)
								if MSMGCMagTable[GunIndex] ~= "" then
									while quantity ~=0 do
										local item = MSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Body")
										quantity = quantity-1
									end
								end
							end
						end
					else
						GunIndex = rnd(#MilSMGTableRare);
						local item = MilSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Body")
						quantity = rnd(15)
						if rnd(10) >= 9 then
							while quantity ~=0 do
								_containerFilled:AddItem(MSMGRAmmoTable2[GunIndex]);
								quantity = quantity-1
							end
						else
							while quantity ~=0 do
								_containerFilled:AddItem(MSMGRAmmoTable[GunIndex]);
								quantity = quantity-1
							end
						end
						if rnd(10) >= 9 then
							if rnd(10) >= 9 then
								_containerFilled:AddItem(MSMGRBoxTable2[GunIndex]);
							else
								_containerFilled:AddItem(MSMGRBoxTable[GunIndex]);
							end
						end
						if diff >= 2 then
							if rnd(10) >= 7 then
								quantity = rnd(2)
								if MSMGRMagTable[GunIndex] ~= "" then
									while quantity ~=0 do
										local item = MSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Body")
										quantity = quantity-1
									end
								end
							end
						end
					end
				end
			end
		end
	elseif _roomName == "bedroom" and _containerType == "wardrobe" then
		if rnd (100) > 90 then
			if rnd (100) < 80 then
				GunIndex = rnd(#CivSMGTableCom);
				if rnd(10) >= 9 then
					local item = CivSMGTableCom[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "House")
					quantity = rnd(6)
					if rnd(10) >= 8 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGCAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGCAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
				end
				if rnd(10) >= 9 then
					quantity = rnd(22)
					if rnd(10) >= 8 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGCAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGCAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
				end
				if diff >= 2 then
					if rnd(10) >= 9 then
						if rnd (10) >= 9 then
							quantity = 2
						else
							quantity = 1
						end
						while quantity ~= 0 do
							local item = CSMGCMagTable[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "House")
							quantity = quantity-1
						end
					end
				end
				if rnd(10) >= 9 then
					if rnd (10) >= 9 then
						quantity = 2
					else
						quantity = 1
					end
					if rnd(10) >= 8 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGCBoxTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGCBoxTable[GunIndex]);
							quantity = quantity-1
						end
					end
				end
				if rnd(100) >= 95 then
					ModIndex = rnd(#CivModTable);
					_containerFilled:AddItem(CivModTable[ModIndex]);
				end
				if rnd(100) >= 95 then
					RepairIndex = rnd(#RepairTable);
					_containerFilled:AddItem(RepairTable[RepairIndex]);
				end
			elseif rnd (10) >= 8 then
				GunIndex = rnd(#CivSMGTableRare);
				if rnd(10) >= 9 then
					local item = CivSMGTableRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "House")
					quantity = rnd(6)
					if rnd(10) >= 8 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGRAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGRAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
				end
				if rnd(10) >= 9 then
					quantity = rnd(22)
					if rnd(10) >= 8 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGRAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGRAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
				end
				if diff >= 2 then
					if rnd(10) >= 9 then
						if rnd (10) >= 9 then
							quantity = 2
						else
							quantity = 1
						end
						while quantity ~= 0 do
							local item = CSMGRMagTable[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "House")
							quantity = quantity-1
						end
					end
				end
				if rnd(10) >= 9 then
					if rnd (10) >= 9 then
						quantity = 2
					else
						quantity = 1
					end
					if rnd(10) >= 8 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGRBoxTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGRBoxTable[GunIndex]);
							quantity = quantity-1
						end
					end
				end
				if rnd(100) >= 95 then
					ModIndex = rnd(#CivModTable);
					_containerFilled:AddItem(CivModTable[ModIndex]);
				end
				if rnd(100) >= 95 then
					RepairIndex = rnd(#RepairTable);
					_containerFilled:AddItem(RepairTable[RepairIndex]);
				end
			else
				GunIndex = rnd(#CivSMGTableSuperRare);
				if rnd(10) >= 9 then
					local item = CivSMGTableSuperRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "House")
					quantity = rnd(6)
					if rnd(10) >= 8 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGSRAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGSRAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
				end
				if rnd(10) >= 9 then
					quantity = rnd(22)
					if rnd(10) >= 8 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGSRAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGSRAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
				end
				if diff >= 2 then
					if rnd(10) >= 9 then
						if rnd (10) >= 9 then
							quantity = 2
						else
							quantity = 1
						end
						while quantity ~= 0 do
							local item = CSMGSRMagTable[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "House")
							quantity = quantity-1
						end
					end
				end
				if rnd(10) >= 9 then
					if rnd (10) >= 9 then
						quantity = 2
					else
						quantity = 1
					end
					if rnd(10) >= 8 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGSRBoxTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGSRBoxTable[GunIndex]);
							quantity = quantity-1
						end
					end
				end
				if rnd(100) >= 95 then
					ModIndex = rnd(#CivModTable);
					_containerFilled:AddItem(CivModTable[ModIndex]);
				end
				if rnd(100) >= 95 then
					RepairIndex = rnd(#RepairTable);
					_containerFilled:AddItem(RepairTable[RepairIndex]);
				end
			end
		end
	elseif _roomName == "zippeestore" and _containerType == "counter" then
		if rnd(100) >=90 then
			GunIndex = rnd(#CivSMGTable);
			if rnd(10) >= 8 then
				local item = CivSMGTable[GunIndex]
				QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Gas")
				if rnd (10) >= 6 then
					quantity = rnd (4)
				else
					quantity = 1
				end
				while quantity ~= 0 do
					_containerFilled:AddItem("QS.12gRounds");
					quantity = quantity-1
				end
				if rnd(10) >= 8 then
					_containerFilled:AddItem("QS.12gBox");
				end
			end
		end
	elseif _roomName == "fossoil" and _containerType == "counter" then
		if rnd(100) >=90 then
			GunIndex = rnd(#CivSMGTable);
			if rnd(10) >= 8 then
				local item = CivSMGTable[GunIndex]
				QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Gas")
				if rnd (10) >= 6 then
					quantity = rnd (4)
				else
					quantity = 1
				end
				while quantity ~= 0 do
					_containerFilled:AddItem("QS.12gRounds");
					quantity = quantity-1
				end
				if rnd(10) >= 8 then
					_containerFilled:AddItem("QS.12gBox");
				end
			end
		end
	elseif _roomName == "gasstore" and _containerType == "counter" then
		if rnd(100) >=90 then
			GunIndex = rnd(#CivSMGTable);
			if rnd(10) >= 8 then
				local item = CivSMGTable[GunIndex]
				QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Gas")
				if rnd (10) >= 6 then
					quantity = rnd (4)
				else
					quantity = 1
				end
				while quantity ~= 0 do
					_containerFilled:AddItem("QS.12gRounds");
					quantity = quantity-1
				end
				if rnd(10) >= 8 then
					_containerFilled:AddItem("QS.12gBox");
				end
			end
		end
	elseif _roomName == "bar" and _containerType == "counter" then
		if rnd(100) >=85 then
			GunIndex = rnd(#CivSMGTable);
			if rnd(10) >= 8 then
				local item = CivSMGTable[GunIndex]
				QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Gas")
				if rnd (10) >= 6 then
					quantity = rnd (4)
				else
					quantity = 1
				end
				while quantity ~= 0 do
					_containerFilled:AddItem("QS.12gRounds");
					quantity = quantity-1
				end
				if rnd(10) >= 8 then
					_containerFilled:AddItem("QS.12gBox");
				end
			end
		end
	elseif _roomName == "policestorage" then
		quantity = rnd(1)
		while quantity ~= 0 do
			if rnd (10) < 7 then
				if rnd (10) < 8 then
					GunIndex = rnd(#PolSMGTableCom);
					if rnd(10) >= 4 then
					local item = PolSMGTableCom[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Police", "Police")
					end
					if rnd (10) < 8 then
						quantity1 = 1
						if rnd(10) >=4 then
							quantity1 = quantity1 + rnd(2)
						end
						if rnd(10) >=8 then
							quantity1 = quantity1 + rnd(2)
						end
						while quantity1 ~= 0 do
							_containerFilled:AddItem(PSMGCBoxTable[GunIndex]);
							quantity1 = quantity1 - 1
						end
					else
						_containerFilled:AddItem(PSMGCCanTable[GunIndex]);					
					end
					if diff >= 2 then
						if rnd(10) >= 4 then
							quantity1 = 1
							if rnd(10) >= 6 then
								quantity1 = quantity1 + rnd(2)
							end
							while quantity1 ~= 0 do
								local item = PSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Police", "Police")
								quantity1 = quantity1 - 1
							end
						end
					end
					if rnd(10) >= 7 then
						ModIndex = rnd(#NonCivModTable);
						_containerFilled:AddItem(NonCivModTable[ModIndex]);
					end
					if rnd(10) >= 6 then
						RepairIndex = rnd(#RepairTable);
						_containerFilled:AddItem(RepairTable[RepairIndex]);
					end
				else
					GunIndex = rnd(#PolSMGTableRare);
					if rnd(10) >= 4 then
					local item = PolSMGTableRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Police", "Police")
					end
					if rnd (10) < 8 then
						quantity1 = 1
						if rnd(10) >=4 then
							quantity1 = quantity1 + rnd(2)
						end
						if rnd(10) >=8 then
							quantity1 = quantity1 + rnd(2)
						end
						while quantity1 ~= 0 do
							_containerFilled:AddItem(PSMGRBoxTable[GunIndex]);
							quantity1 = quantity1 - 1
						end
					else
						_containerFilled:AddItem(PSMGRCanTable[GunIndex]);					
					end
					if diff >= 2 then
						if rnd(10) >= 4 then
							quantity1 = 1
							if rnd(10) >= 6 then
								quantity1 = quantity1 + rnd(2)
							end
							while quantity1 ~= 0 do
								local item = PSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Police", "Police")
								quantity1 = quantity1 - 1
							end
						end
					end
					if rnd(10) >= 7 then
						ModIndex = rnd(#NonCivModTable);
						_containerFilled:AddItem(NonCivModTable[ModIndex]);
					end
					if rnd(10) >= 6 then
						RepairIndex = rnd(#RepairTable);
						_containerFilled:AddItem(RepairTable[RepairIndex]);
					end
				end
			else
				if rnd (10) < 8 then
					GunIndex = rnd(#MilSMGTableCom);
					if rnd(10) >= 4 then
					local item = MilSMGTableCom[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Military", "Police")
					end
					if rnd (10) < 8 then
						quantity1 = 1
						if rnd(10) >=4 then
							quantity1 = quantity1 + rnd(2)
						end
						if rnd(10) >=8 then
							quantity1 = quantity1 + rnd(2)
						end
						while quantity1 ~= 0 do
							_containerFilled:AddItem(MSMGCBoxTable[GunIndex]);
							quantity1 = quantity1 - 1
						end
					else
						_containerFilled:AddItem(MSMGCCanTable[GunIndex]);					
					end
					if diff >= 2 then
						if rnd(10) >= 4 then
							quantity1 = 1
							if rnd(10) >= 6 then
								quantity1 = quantity1 + rnd(2)
							end
							while quantity1 ~= 0 do
								local item = MSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Military", "Police")
								quantity1 = quantity1 - 1
							end
						end
					end
					if rnd(10) >= 7 then
						ModIndex = rnd(#NonCivModTable);
						_containerFilled:AddItem(NonCivModTable[ModIndex]);
					end
					if rnd(10) >= 6 then
						RepairIndex = rnd(#RepairTable);
						_containerFilled:AddItem(RepairTable[RepairIndex]);
					end
				else
					GunIndex = rnd(#MilSMGTableRare);
					if rnd(10) >= 4 then
					local item = MilSMGTableRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Military", "Police")
					end
					if rnd (10) < 8 then
						quantity1 = 1
						if rnd(10) >=4 then
							quantity1 = quantity1 + rnd(2)
						end
						if rnd(10) >=8 then
							quantity1 = quantity1 + rnd(2)
						end
						while quantity1 ~= 0 do
							_containerFilled:AddItem(MSMGRBoxTable[GunIndex]);
							quantity1 = quantity1 - 1
						end
					else
						_containerFilled:AddItem(MSMGRCanTable[GunIndex]);					
					end
					if diff >= 2 then
						if rnd(10) >= 4 then
							quantity1 = 1
							if rnd(10) >= 6 then
								quantity1 = quantity1 + rnd(2)
							end
							while quantity1 ~= 0 do
								local item = MSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Military", "Police")
								quantity1 = quantity1 - 1
							end
						end
					end
					if rnd(10) >= 7 then
						ModIndex = rnd(#NonCivModTable);
						_containerFilled:AddItem(NonCivModTable[ModIndex]);
					end
					if rnd(10) >= 6 then
						RepairIndex = rnd(#RepairTable);
						_containerFilled:AddItem(RepairTable[RepairIndex]);
					end
				end
				quantity = quantity -1
			end
		end
	elseif _roomName == "gunstore" and _containerType == "locker" then
		if rnd(20) >= 1 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 2 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 3 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 4 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 5 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 6 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 7 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 9 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 11 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 13 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 15 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 17 then
			ammoindex = rnd(#AllCanTable);
			_containerFilled:AddItem(AllCanTable[ammoindex]);
		end
		if rnd(20) >= 19 then
			ammoindex = rnd(#AllCanTable);
			_containerFilled:AddItem(AllCanTable[ammoindex]);
		end
		if rnd(4) >= 1 then
			RepairIndex = rnd(#RepairTable);
			local item = _containerFilled:AddItem(RepairTable[RepairIndex]);
		end
	elseif _roomName == "gunstore" and _containerType == "counter" then
		if rnd(20) >= 2 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 4 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 6 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 8 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 10 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 12 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 14 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 16 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 18 then
			ammoindex = rnd(#AllCanTable);
			_containerFilled:AddItem(AllCanTable[ammoindex]);
		end
		if rnd(20) >= 20 then
			ammoindex = rnd(#AllCanTable);
			_containerFilled:AddItem(AllCanTable[ammoindex]);
		end
		if rnd(5) >= 2 then
			RepairIndex = rnd(#RepairTable);
			_containerFilled:AddItem(RepairTable[RepairIndex]);
		end
	elseif _roomName == "gunstore" and _containerType == "displaycase" then
		if rnd(100) >= 5 then
			if rnd(100) < 85 then
				if rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableCom);
					local item = CivSMGTableCom[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end
				elseif rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableRare);
					local item = CivSMGTableRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end
				else
					GunIndex = rnd(#CivSMGTableSuperRare);
					local item = CivSMGTableSuperRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGSRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGSRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end	
				end
			else		
				if rnd (10) < 7 then
					if rnd (10) < 8 then
						GunIndex = rnd(#PolSMGTableCom);
						local item = PolSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = PSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = PSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					else
						GunIndex = rnd(#PolSMGTableRare);
						local item = PolSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = PSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = PSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					end
				else
					if rnd (10) < 8 then
						GunIndex = rnd(#MilSMGTableCom);
						local item = MilSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = MSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = MSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					else
						GunIndex = rnd(#MilSMGTableRare);
						local item = MilSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = MSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = MSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					end
				end
			end
		end
		if rnd(100) >= 25 then
			if rnd(100) < 85 then
				if rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableCom);
					local item = CivSMGTableCom[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end
				elseif rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableRare);
					local item = CivSMGTableRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end
				else
					GunIndex = rnd(#CivSMGTableSuperRare);
					local item = CivSMGTableSuperRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGSRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGSRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end	
				end
			else		
				if rnd (10) < 7 then
					if rnd (10) < 8 then
						GunIndex = rnd(#PolSMGTableCom);
						local item = PolSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = PSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = PSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					else
						GunIndex = rnd(#PolSMGTableRare);
						local item = PolSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = PSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = PSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					end
				else
					if rnd (10) < 8 then
						GunIndex = rnd(#MilSMGTableCom);
						local item = MilSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = MSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = MSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					else
						GunIndex = rnd(#MilSMGTableRare);
						local item = MilSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = MSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = MSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					end
				end
			end
		end
		if rnd(5) >= 2 then
			if rnd(10) < 9 then
				ModIndex = rnd(#CivModTable);
				_containerFilled:AddItem(CivModTable[ModIndex]);
			else
				ModIndex = rnd(#NonCivModTable);
				_containerFilled:AddItem(NonCivModTable[ModIndex]);
			end
		end
	elseif _roomName == "gunstorestorage" and _containerType == "metal_shelves" then
		if rnd(100) >= 5 then
			if rnd(100) < 85 then
				if rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableCom);
					local item = CivSMGTableCom[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end
				elseif rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableRare);
					local item = CivSMGTableRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end
				else
					GunIndex = rnd(#CivSMGTableSuperRare);
					local item = CivSMGTableSuperRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGSRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGSRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end	
				end
			else		
				if rnd (10) < 7 then
					if rnd (10) < 8 then
						GunIndex = rnd(#PolSMGTableCom);
						local item = PolSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = PSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = PSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					else
						GunIndex = rnd(#PolSMGTableRare);
						local item = PolSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = PSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = PSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					end
				else
					if rnd (10) < 8 then
						GunIndex = rnd(#MilSMGTableCom);
						local item = MilSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = MSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = MSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					else
						GunIndex = rnd(#MilSMGTableRare);
						local item = MilSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = MSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = MSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					end
				end
			end
		end
		if rnd(100) >= 25 then
			if rnd(100) < 85 then
				if rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableCom);
					local item = CivSMGTableCom[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end
				elseif rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableRare);
					local item = CivSMGTableRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end
				else
					GunIndex = rnd(#CivSMGTableSuperRare);
					local item = CivSMGTableSuperRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGSRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGSRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end	
				end
			else		
				if rnd (10) < 7 then
					if rnd (10) < 8 then
						GunIndex = rnd(#PolSMGTableCom);
						local item = PolSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = PSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = PSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					else
						GunIndex = rnd(#PolSMGTableRare);
						local item = PolSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = PSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = PSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					end
				else
					if rnd (10) < 8 then
						GunIndex = rnd(#MilSMGTableCom);
						local item = MilSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = MSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = MSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					else
						GunIndex = rnd(#MilSMGTableRare);
						local item = MilSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = MSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = MSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					end
				end
			end
		end
		if rnd(5) >= 2 then
			if rnd(10) < 9 then
				ModIndex = rnd(#CivModTable);
				_containerFilled:AddItem(CivModTable[ModIndex]);
			else
				ModIndex = rnd(#NonCivModTable);
				_containerFilled:AddItem(NonCivModTable[ModIndex]);
			end
		end
		if rnd(5) >= 42 then
			if rnd(10) < 9 then
				ModIndex = rnd(#CivModTable);
				_containerFilled:AddItem(CivModTable[ModIndex]);
			else
				ModIndex = rnd(#NonCivModTable);
				_containerFilled:AddItem(NonCivModTable[ModIndex]);
			end
		end
		if rnd(20) >= 2 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 4 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 6 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 8 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 10 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 12 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 14 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 16 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 18 then
			ammoindex = rnd(#AllCanTable);
			_containerFilled:AddItem(AllCanTable[ammoindex]);
		end
		if rnd(20) >= 20 then
			ammoindex = rnd(#AllCanTable);
			_containerFilled:AddItem(AllCanTable[ammoindex]);
		end
		if rnd(5) >= 2 then
			RepairIndex = rnd(#RepairTable);
			local item = _containerFilled:AddItem(RepairTable[RepairIndex]);
		end
	elseif _roomName == "gunstorestorage" and _containerType == "crate" then
		if rnd(100) >= 1 then
			if rnd(100) < 85 then
				if rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableCom);
					local item = CivSMGTableCom[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end
				elseif rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableRare);
					local item = CivSMGTableRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end
				else
					GunIndex = rnd(#CivSMGTableSuperRare);
					local item = CivSMGTableSuperRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGSRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGSRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end	
				end
			else		
				if rnd (10) < 7 then
					if rnd (10) < 8 then
						GunIndex = rnd(#PolSMGTableCom);
						local item = PolSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = PSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = PSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					else
						GunIndex = rnd(#PolSMGTableRare);
						local item = PolSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = PSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = PSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					end
				else
					if rnd (10) < 8 then
						GunIndex = rnd(#MilSMGTableCom);
						local item = MilSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = MSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = MSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					else
						GunIndex = rnd(#MilSMGTableRare);
						local item = MilSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = MSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = MSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					end
				end
			end
		end
		if rnd(100) >= 20 then
			if rnd(100) < 85 then
				if rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableCom);
					local item = CivSMGTableCom[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end
				elseif rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableRare);
					local item = CivSMGTableRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end
				else
					GunIndex = rnd(#CivSMGTableSuperRare);
					local item = CivSMGTableSuperRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGSRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGSRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end	
				end
			else		
				if rnd (10) < 7 then
					if rnd (10) < 8 then
						GunIndex = rnd(#PolSMGTableCom);
						local item = PolSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = PSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = PSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					else
						GunIndex = rnd(#PolSMGTableRare);
						local item = PolSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = PSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = PSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					end
				else
					if rnd (10) < 8 then
						GunIndex = rnd(#MilSMGTableCom);
						local item = MilSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = MSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = MSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					else
						GunIndex = rnd(#MilSMGTableRare);
						local item = MilSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = MSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = MSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					end
				end
			end
		end
		if rnd(100) >= 60 then
			if rnd(100) < 85 then
				if rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableCom);
					local item = CivSMGTableCom[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end
				elseif rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableRare);
					local item = CivSMGTableRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end
				else
					GunIndex = rnd(#CivSMGTableSuperRare);
					local item = CivSMGTableSuperRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						if diff >= 2 then
							if rnd(10) >= 3 then
								local item = CSMGSRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
							if rnd(10) >= 7 then
								local item = CSMGSRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							end
						end	
				end
			else		
				if rnd (10) < 7 then
					if rnd (10) < 8 then
						GunIndex = rnd(#PolSMGTableCom);
						local item = PolSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = PSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = PSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					else
						GunIndex = rnd(#PolSMGTableRare);
						local item = PolSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = PSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = PSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					end
				else
					if rnd (10) < 8 then
						GunIndex = rnd(#MilSMGTableCom);
						local item = MilSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = MSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = MSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					else
						GunIndex = rnd(#MilSMGTableRare);
						local item = MilSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = MSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
								if rnd(10) >= 7 then
									local item = MSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								end
							end
					end
				end
			end
		end
		if rnd(5) >= 1 then
			if rnd(10) < 9 then
				ModIndex = rnd(#CivModTable);
				_containerFilled:AddItem(CivModTable[ModIndex]);
			else
				ModIndex = rnd(#NonCivModTable);
				_containerFilled:AddItem(NonCivModTable[ModIndex]);
			end
		end
		if rnd(5) >= 2 then
			if rnd(10) < 9 then
				ModIndex = rnd(#CivModTable);
				_containerFilled:AddItem(CivModTable[ModIndex]);
			else
				ModIndex = rnd(#NonCivModTable);
				_containerFilled:AddItem(NonCivModTable[ModIndex]);
			end
		end
		if rnd(20) >= 2 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 4 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 6 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 8 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 10 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 12 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 14 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 16 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 18 then
			ammoindex = rnd(#AllCanTable);
			_containerFilled:AddItem(AllCanTable[ammoindex]);
		end
		if rnd(20) >= 20 then
			ammoindex = rnd(#AllCanTable);
			_containerFilled:AddItem(AllCanTable[ammoindex]);
		end
		if rnd(5) >= 2 then
			RepairIndex = rnd(#RepairTable);
			_containerFilled:AddItem(RepairTable[RepairIndex]);
		end
		if rnd(20) >= 2 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 4 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 6 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 8 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 10 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 12 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 14 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 16 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 18 then
			ammoindex = rnd(#AllBoxTable);
			_containerFilled:AddItem(AllBoxTable[ammoindex]);
		end
		if rnd(20) >= 20 then
			ammoindex = rnd(#AllCanTable);
			_containerFilled:AddItem(AllCanTable[ammoindex]);
		end
		if rnd(5) >= 2 then
			RepairIndex = rnd(#RepairTable);
			_containerFilled:AddItem(RepairTable[RepairIndex]);
		end
	elseif _roomName == "storageunit" and _containerType == "crate" then
		if rnd(100) >= 85 then
			if rnd(100) >= 5 then
				if rnd(100) < 85 then
					if rnd (10) < 8 then
						GunIndex = rnd(#CivSMGTableCom);
						local item = CivSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = CSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
								if rnd(10) >= 7 then
									local item = CSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
							end
					elseif rnd (10) < 8 then
						GunIndex = rnd(#CivSMGTableRare);
						local item = CivSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = CSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
								if rnd(10) >= 7 then
									local item = CSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
							end
					else
						GunIndex = rnd(#CivSMGTableSuperRare);
						local item = CivSMGTableSuperRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = CSMGSRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
								if rnd(10) >= 7 then
									local item = CSMGSRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
							end
					end
				else		
					if rnd (10) < 7 then
						if rnd (10) < 8 then
							GunIndex = rnd(#PolSMGTableCom);
							local item = PolSMGTableCom[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = PSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
									if rnd(10) >= 7 then
										local item = PSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
								end
						else
							GunIndex = rnd(#PolSMGTableRare);
							local item = PolSMGTableRare[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = PSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
									if rnd(10) >= 7 then
										local item = PSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
								end
						end
					else
						if rnd (10) < 8 then
							GunIndex = rnd(#MilSMGTableCom);
							local item = MilSMGTableCom[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = MSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
									if rnd(10) >= 7 then
										local item = MSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
								end
						else
							GunIndex = rnd(#MilSMGTableRare);
							local item = MilSMGTableRare[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = MSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
									if rnd(10) >= 7 then
										local item = MSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
								end
						end
					end
				end
			end
			if rnd(100) >= 25 then
				if rnd(100) < 85 then
					if rnd (10) < 8 then
						GunIndex = rnd(#CivSMGTableCom);
						local item = CivSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = CSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
								if rnd(10) >= 7 then
									local item = CSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
							end
					elseif rnd (10) < 8 then
						GunIndex = rnd(#CivSMGTableRare);
						local item = CivSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = CSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
								if rnd(10) >= 7 then
									local item = CSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
							end
					else
						GunIndex = rnd(#CivSMGTableSuperRare);
						local item = CivSMGTableSuperRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = CSMGSRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
								if rnd(10) >= 7 then
									local item = CSMGSRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
							end
					end
				else		
					if rnd (10) < 7 then
						if rnd (10) < 8 then
							GunIndex = rnd(#PolSMGTableCom);
							local item = PolSMGTableCom[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = PSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
									if rnd(10) >= 7 then
										local item = PSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
								end
						else
							GunIndex = rnd(#PolSMGTableRare);
							local item = PolSMGTableRare[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = PSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
									if rnd(10) >= 7 then
										local item = PSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
								end
						end
					else
						if rnd (10) < 8 then
							GunIndex = rnd(#MilSMGTableCom);
							local item = MilSMGTableCom[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = MSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
									if rnd(10) >= 7 then
										local item = MSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
								end
						else
							GunIndex = rnd(#MilSMGTableRare);
							local item = MilSMGTableRare[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = MSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
									if rnd(10) >= 7 then
										local item = MSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
								end
						end
					end
				end
			end
			if rnd(5) >= 2 then
				if rnd(10) < 9 then
					ModIndex = rnd(#CivModTable);
					_containerFilled:AddItem(CivModTable[ModIndex]);
				else
					ModIndex = rnd(#NonCivModTable);
					_containerFilled:AddItem(NonCivModTable[ModIndex]);
				end
			end
			if rnd(5) >= 42 then
				if rnd(10) < 9 then
					ModIndex = rnd(#CivModTable);
					_containerFilled:AddItem(CivModTable[ModIndex]);
				else
					ModIndex = rnd(#NonCivModTable);
					_containerFilled:AddItem(NonCivModTable[ModIndex]);
				end
			end
			if rnd(20) >= 2 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 4 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 6 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 8 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 10 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 12 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 14 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 16 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 18 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 20 then
				ammoindex = rnd(#AllCanTable);
				_containerFilled:AddItem(AllCanTable[ammoindex]);
			end
			if rnd(5) >= 2 then
				RepairIndex = rnd(#RepairTable);
				local item = _containerFilled:AddItem(RepairTable[RepairIndex]);
			end
		end
	elseif _roomName == "garagestorage" and _containerType == "smallbox" then
		if rnd(100) >= 85 then
			if rnd(100) >= 5 then
				if rnd(100) < 85 then
					if rnd (10) < 8 then
						GunIndex = rnd(#CivSMGTableCom);
						local item = CivSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = CSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
								if rnd(10) >= 7 then
									local item = CSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
							end
					elseif rnd (10) < 8 then
						GunIndex = rnd(#CivSMGTableRare);
						local item = CivSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = CSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
								if rnd(10) >= 7 then
									local item = CSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
							end
					else
						GunIndex = rnd(#CivSMGTableSuperRare);
						local item = CivSMGTableSuperRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = CSMGSRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
								if rnd(10) >= 7 then
									local item = CSMGSRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
							end
					end
				else		
					if rnd (10) < 7 then
						if rnd (10) < 8 then
							GunIndex = rnd(#PolSMGTableCom);
							local item = PolSMGTableCom[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = PSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
									if rnd(10) >= 7 then
										local item = PSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
								end
						else
							GunIndex = rnd(#PolSMGTableRare);
							local item = PolSMGTableRare[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = PSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
									if rnd(10) >= 7 then
										local item = PSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
								end
						end
					else
						if rnd (10) < 8 then
							GunIndex = rnd(#MilSMGTableCom);
							local item = MilSMGTableCom[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = MSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
									if rnd(10) >= 7 then
										local item = MSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
								end
						else
							GunIndex = rnd(#MilSMGTableRare);
							local item = MilSMGTableRare[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = MSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
									if rnd(10) >= 7 then
										local item = MSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
								end
						end
					end
				end
			end
			if rnd(100) >= 25 then
				if rnd(100) < 85 then
					if rnd (10) < 8 then
						GunIndex = rnd(#CivSMGTableCom);
						local item = CivSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = CSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
								if rnd(10) >= 7 then
									local item = CSMGCMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
							end
					elseif rnd (10) < 8 then
						GunIndex = rnd(#CivSMGTableRare);
						local item = CivSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = CSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
								if rnd(10) >= 7 then
									local item = CSMGRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
							end
					else
						GunIndex = rnd(#CivSMGTableSuperRare);
						local item = CivSMGTableSuperRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
							if diff >= 2 then
								if rnd(10) >= 3 then
									local item = CSMGSRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
								if rnd(10) >= 7 then
									local item = CSMGSRMagTable[GunIndex]
									QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
								end
							end
					end
				else		
					if rnd (10) < 7 then
						if rnd (10) < 8 then
							GunIndex = rnd(#PolSMGTableCom);
							local item = PolSMGTableCom[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = PSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
									if rnd(10) >= 7 then
										local item = PSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
								end
						else
							GunIndex = rnd(#PolSMGTableRare);
							local item = PolSMGTableRare[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = PSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
									if rnd(10) >= 7 then
										local item = PSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
									end
								end
						end
					else
						if rnd (10) < 8 then
							GunIndex = rnd(#MilSMGTableCom);
							local item = MilSMGTableCom[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = MSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
									if rnd(10) >= 7 then
										local item = MSMGCMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
								end
						else
							GunIndex = rnd(#MilSMGTableRare);
							local item = MilSMGTableRare[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
								if diff >= 2 then
									if rnd(10) >= 3 then
										local item = MSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
									if rnd(10) >= 7 then
										local item = MSMGRMagTable[GunIndex]
										QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
									end
								end
						end
					end
				end
			end
			if rnd(5) >= 2 then
				if rnd(10) < 9 then
					ModIndex = rnd(#CivModTable);
					_containerFilled:AddItem(CivModTable[ModIndex]);
				else
					ModIndex = rnd(#NonCivModTable);
					_containerFilled:AddItem(NonCivModTable[ModIndex]);
				end
			end
			if rnd(5) >= 42 then
				if rnd(10) < 9 then
					ModIndex = rnd(#CivModTable);
					_containerFilled:AddItem(CivModTable[ModIndex]);
				else
					ModIndex = rnd(#NonCivModTable);
					_containerFilled:AddItem(NonCivModTable[ModIndex]);
				end
			end
			if rnd(20) >= 2 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 4 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 6 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 8 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 10 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 12 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 14 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 16 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 18 then
				ammoindex = rnd(#AllBoxTable);
				_containerFilled:AddItem(AllBoxTable[ammoindex]);
			end
			if rnd(20) >= 20 then
				ammoindex = rnd(#AllCanTable);
				_containerFilled:AddItem(AllCanTable[ammoindex]);
			end
			if rnd(5) >= 2 then
				RepairIndex = rnd(#RepairTable);
				local item = _containerFilled:AddItem(RepairTable[RepairIndex]);
			end
		end
	elseif _roomName == "hunting" and _containerType == "metal_shelves" then
		if rnd(100) >= 35 then
			if rnd(10) < 8 then
				if rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableCom);
					local item = CivSMGTableCom[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
					quantity = rnd(20)
					if rnd(10) >= 9 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGCAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGCAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
					if rnd(10) >= 6 then
						if rnd(10) >= 9 then
							_containerFilled:AddItem(CSMGCBoxTable2[GunIndex]);
						else
							_containerFilled:AddItem(CSMGCBoxTable[GunIndex]);
						end
					end
					if diff >= 2 then
						if rnd(10) >= 4 then
							local item = CSMGCMagTable[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						end
						if rnd(10) >= 8 then
							local item = CSMGCMagTable[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						end
					end
				elseif rnd (10) < 8 then
					GunIndex = rnd(#CivSMGTableRare);
					local item = CivSMGTableRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
					quantity = rnd(20)
					if rnd(10) >= 9 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGRAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGRAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
					if rnd(10) >= 6 then
						if rnd(10) >= 9 then
							_containerFilled:AddItem(CSMGRBoxTable2[GunIndex]);
						else
							_containerFilled:AddItem(CSMGRBoxTable[GunIndex]);
						end
					end
					if diff >= 2 then
						if rnd(10) >= 4 then
							local item = CSMGRMagTable[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						end
						if rnd(10) >= 8 then
							local item = CSMGRMagTable[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						end
					end
				else
					GunIndex = rnd(#CivSMGTableSuperRare);
					local item = CivSMGTableSuperRare[GunIndex]
					QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
					quantity = rnd(20)
					if rnd(10) >= 9 then
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGSRAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(CSMGSRAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
					if rnd(10) >= 6 then
						if rnd(10) >= 9 then
							_containerFilled:AddItem(CSMGSRBoxTable2[GunIndex]);
						else
							_containerFilled:AddItem(CSMGSRBoxTable[GunIndex]);
						end
					end
					if diff >= 2 then
						if rnd(10) >= 4 then
							local item = CSMGSRMagTable[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						end
						if rnd(10) >= 8 then
							local item = CSMGSRMagTable[GunIndex]
							QSItemGen:GenerateItem(_containerFilled, item, "Civilian", "Store")
						end
					end
				end
			else		
				if rnd (10) < 7 then
					if rnd (10) < 8 then
						GunIndex = rnd(#PolSMGTableCom);
						local item = PolSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
					quantity = rnd(20)
					if rnd(10) >= 9 then
						while quantity ~=0 do
							_containerFilled:AddItem(PSMGCAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(PSMGCAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
					if rnd(10) >= 6 then
						if rnd(10) >= 9 then
							_containerFilled:AddItem(PSMGCBoxTable2[GunIndex]);
						else
							_containerFilled:AddItem(PSMGCBoxTable[GunIndex]);
						end
					end
						if diff >= 2 then
							if rnd(10) >= 4 then
								local item = PSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							end
							if rnd(10) >= 8 then
								local item = PSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							end
						end
					else
						GunIndex = rnd(#PolSMGTableRare);
						local item = PolSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
					quantity = rnd(20)
					if rnd(10) >= 9 then
						while quantity ~=0 do
							_containerFilled:AddItem(PSMGRAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(PSMGRAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
					if rnd(10) >= 6 then
						if rnd(10) >= 9 then
							_containerFilled:AddItem(PSMGRBoxTable2[GunIndex]);
						else
							_containerFilled:AddItem(PSMGRBoxTable[GunIndex]);
						end
					end
						if diff >= 2 then
							if rnd(10) >= 4 then
								local item = PSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							end
							if rnd(10) >= 8 then
								local item = PSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Police", "Store")
							end
						end
					end
				else
					if rnd (10) < 8 then
						GunIndex = rnd(#MilSMGTableCom);
						local item = MilSMGTableCom[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
					quantity = rnd(20)
					if rnd(10) >= 9 then
						while quantity ~=0 do
							_containerFilled:AddItem(MSMGCAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(MSMGCAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
					if rnd(10) >= 6 then
						if rnd(10) >= 9 then
							_containerFilled:AddItem(MSMGCBoxTable[GunIndex]);
						else
							_containerFilled:AddItem(MSMGCBoxTable[GunIndex]);
						end
					end
						if diff >= 2 then
							if rnd(10) >= 4 then
								local item = MSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							end
							if rnd(10) >= 8 then
								local item = MSMGCMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							end
						end
					else
						GunIndex = rnd(#MilSMGTableRare);
						local item = MilSMGTableRare[GunIndex]
						QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
					quantity = rnd(20)
					if rnd(10) >= 9 then
						while quantity ~=0 do
							_containerFilled:AddItem(MSMGRAmmoTable2[GunIndex]);
							quantity = quantity-1
						end
					else
						while quantity ~=0 do
							_containerFilled:AddItem(MSMGRAmmoTable[GunIndex]);
							quantity = quantity-1
						end
					end
					if rnd(10) >= 6 then
						if rnd(10) >= 9 then
							_containerFilled:AddItem(MSMGRBoxTable2[GunIndex]);
						else
							_containerFilled:AddItem(MSMGRBoxTable[GunIndex]);
						end
					end
						if diff >= 2 then
							if rnd(10) >= 4 then
								local item = MSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							end
							if rnd(10) >= 8 then
								local item = MSMGRMagTable[GunIndex]
								QSItemGen:GenerateItem(_containerFilled, item, "Military", "Store")
							end
						end
					end
				end
			end
		end
	end
end
	
	-- SMGS
	CivSMGTableCom = {	
		"QS.Skorpion",
		"QS.UZI",
		"QS.UZIL40",
		"QS.MAC10",
		};
	CivSMGTableRare = {	
		"QS.TEC9",
		"QS.LF57",
		"QS.MP5sawed",
		"QS.UMPsawed",
		};	
	CivSMGTableSuperRare = {		
		"QS.MP9",
		"QS.WaltherMP",
		"QS.Agram2000",
		"QS.VityazSN",
		};	
	CivSMGTable = {		
		"QS.LF57",
		"QS.UZI",
		"QS.UZIL40",
		"QS.MAC10",
		"QS.MP9",
		"QS.Skorpion",
		"QS.TEC9",
		"QS.WaltherMP",
		"QS.ZastavaMFLG",
		"QS.VityazSN",
		};
	PolSMGTableCom = {			
		"QS.MAC10",
		"QS.MP9",
		"QS.WaltherMP",
		"QS.Agram2000",
		};
	PolSMGTableRare = {	
		"QS.UMP",
		"QS.SteyrTMP",
		"QS.MP5",
		"QS.PP2000",
	};
	MilSMGTableCom = {	
		"QS.UMP",
		"QS.ZastavaMFLG",
		"QS.Agram2000",
		"QS.MP5",
		};
	MilSMGTableRare = {	
		"QS.MP5",
		"QS.PP2000",
		"QS.SpectreM4",
		"QS.VityazSN",
		};
		
	-- AMMO
	CSMGCAmmoTable = {	
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
		};
	CSMGCAmmoTable2 = {	
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
		};
	CSMGCBoxTable = {	
	"QS.9mmBox",
	"QS.9mmBox",
		};	
	CSMGCBoxTable2 = {	
	"QS.9mmBox",
	"QS.9mmBox",
		};	
	CSMGCCanTable = {	
	"QS.9mmCan",
	"QS.9mmCan",
		};	
	CSMGCCanTable2 = {	
	"QS.9mmCan",
	"QS.9mmCan",
		};
	CSMGCMagTable = {	
	"",
		};
	
	CSMGRAmmoTable = {	
	"QS.9mmRounds",
	"QS.9mmRounds",
		};
	CSMGRAmmoTable2 = {	
	"QS.9mmRounds",
	"QS.9mmRounds",
		};
	CSMGRBoxTable = {	
	"QS.9mmBox",
	"QS.9mmBox",
		};
	CSMGRBoxTable2 = {	
	"QS.9mmBox",
	"QS.9mmBox",
		};
	CSMGRCanTable = {	
	"QS.9mmCan",
	"QS.9mmCan"
		};
	CSMGRCanTable2 = {	
	"QS.9mmCan",
	"QS.9mmCan",
		};	
	CSMGRMagTable = {	
	"",
		};
		
	CSMGSRAmmoTable = {	
	"QS.9mmRounds",
	"QS.9mmRounds",
		};
	CSMGSRAmmoTable2 = {	
	"QS.9mmRounds",
	"QS.9mmRounds",
		};
	CSMGSRBoxTable = {	
	"QS.9mmBox",
	"QS.9mmBox",
		};
	CSMGSRBoxTable2 = {	
	"QS.9mmBox",
	"QS.9mmBox",
		};
	CSMGSRCanTable = {	
	"QS.9mmCan",
	"QS.9mmCan",
		};
	CSMGSRCanTable = {	
	"QS.9mmCan",
	"QS.9mmCan",
		};
	CSMGSRMagTable = {	
	"",
		};

	PSMGCAmmoTable = {	
	"QS.9mmRounds",
	"QS.9mmRounds",
		};
	PSMGCAmmoTable2 = {	
	"QS.9mmRounds",
	"QS.9mmRounds",
		};	
	PSMGCBoxTable = {	
	"QS.9mmBox",
	"QS.9mmBox",
		};	
	PSMGCBoxTable2 = {	
	"QS.9mmBox",
	"QS.9mmBox",
		};	
	PSMGCCanTable = {	
	"QS.9mmCan",
	"QS.9mmCan",
		};	
	PSMGCCanTable2 = {	
	"QS.9mmCan",
	"QS.9mmCan",
		};
	PSMGCMagTable = {
		"",
		};
		
	PSMGRAmmoTable = {	
	"QS.45ACPRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
		};
	PSMGRAmmoTable2 = {	
	"QS.45ACPRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
		};
	PSMGRBoxTable = {	
	"QS.45ACPBox",
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
		};
	PSMGRBoxTable2 = {	
	"QS.45ACPBox",
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
		};
	PSMGRCanTable = {	
	"QS.45ACPCan",
	"QS.9mmCan",
	"QS.9mmCan",
	"QS.9mmCan",
		};
	PSMGRCanTable2 = {	
	"QS.45ACPCan",
	"QS.9mmCan",
	"QS.9mmCan",
	"QS.9mmCan",
		};
	PSMGRMagTable = {
		"",
		};
	
	MSMGCAmmoTable = {	
	"QS.45ACPRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
		};
	MSMGCBoxTable = {	
	"QS.45ACPBox",
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
		};
	MSMGCCanTable = {	
	"QS.45ACPCan",
	"QS.9mmCan",
	"QS.9mmCan",
	"QS.9mmCan",
		};
	MSMGCMagTable = {
		"",
		};
				
	MSMGRAmmoTable = {	
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
		};
	MSMGRAmmoTable2 = {	
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
		};
	MSMGRBoxTable = {	
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
		};
	MSMGRBoxTable2 = {	
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
		};	
	MSMGRCanTable = {
		"",
		};
	MSMGRMagTable = {
		"",
		};
		
	AllRoundsTable = {	
	"QS.45ACPRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
	"QS.9mmRounds",
		};		
	AllBoxTable = {	
	"QS.45ACPBox",
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
	"QS.9mmBox",
		};	
	AllCanTable = {	
	"QS.9mmCan",
	"QS.45ACPCan",
		};		
	CivModTable = {
		"",
		};	
	NonCivModTable = {
		"",
		};
		
	RepairTable = {	
	"QS.WD40",	
	"QS.Brushkit",	
	"QS.Maintkit",
		};
		
function rnd(_value)
	return ZombRand(_value) + 1;
end

Events.OnFillContainer.Add(QSDistr);

WeaponUpgrades = {

};