What happens if fuel tanks are hit by gunfire?
OK, let me expand my comments about inert gas to Peter Kämpf's answer to an own answer.

Argon or Nitrogen ?

It was asked if Argon is a suitable inert gas. While in principle it is, it is also a rare element and so expensive. A better choice is nitrogen. It makes up 79% of the air and is much cheaper.

For example, I found ~50€ for a 50l bottle of nitrogen and ~100€ for argon.
But one also has to keep in mind that the production capacity for argon is not very high, so if aviation starts to buy large amounts to use it as inert gas, the price would increase soon.

Argon and nitrogen are gases which can not be liquefied at normal temperatures, so they are stored under pressure in bottles like this:



They are made of steel to  withstand the pressure of up to 200-300 bar (atmospheres). So, a big 50l bottle has a weight of 77kg without filling (sorry, german).

Nowadays, also civilian aircraft are often equipped with an inert gas system, since the central wing tank of TWA800 exploded most likely due to electrical short circuits

But when it comes to larger aircrafts with larger tanks, gas bottles become a problem: The A380 has a fuel capacity of 325,000 liters. Imagine you want to fill its tanks from the 50l bottles mentioned above. The content of one bottle expands to 10,000-15,000 liters at sea level pressure, so you need 20-32 bottles for the A380. 

This bottles have a weight of almost 2.5 tons and need some space. The high pressure is also an issue, and of course, you have to refill the bottles after each flight.

So, it's not a good idea to use this system on larger aircrafts.

I was quite sure that I once read that at least small aircrafts like fighters use bottles, but I don't find any evidence. On the other side, a F35 can carry up to 10,000l in its internal tank, so it would also need a 50l bottle. So, I think I misunderstood something.

CO2 ?

The benefit of CO2 is that it becomes liquid under pressure, You won't need so many bottles and the bottles themselves would be lighter. But CO2 may act corrosive if it finds some drops of water, as it turns to carbonic acid.

Exhaust gas?

A gas that is the product of a fire doesn't burn any more.
This is indeed used to fill the tank of large ships, but you can not take it from the main engine: Those are diesel engines always working with an excess of air, so the exhaust gas contains oxygen. The ships burn some fuel with a balanced amount of air in a inert gas generator.

As fans are similar to diesel engines in this context, exhaust gas is no solution. The gas also contains CO2 and water, so may be no good idea in general for aviation.

Halon

Many older combat aircrafts like the F16 use halon to extinguish fire, but also to fill the tanks.
As halon is one of the worst greenhouse gases, its production has been abandoned 1994 and this document describes the search for alternatives working largely the same way:

To explain it in short: Inside a fire, molecules of the burning material break up and connect to oxygen atoms. This connection is what gives the energy we want in our engines and we want not in the tank.
Halon jumps into the reaction and connects itself to the open ends. The reaction between oxygen and the material, which gives the energy, can not take place any more. 

It is said that about 6% of halon in air is enough to extinguish fire, 10% and more can be survived, if exposure time is not too long.

Halon was not used as inert gas, but it was injected into the tanks shortly before a fight was expected

On-Board Inert Gas Generation System(OBIGGS)

Today's solution is to use a On-Board Inert Gas Generation System(OBIGGS) developed by NASA/Boeing

It uses some kind of membrane which can be passed by nitrogen more easily than by oxygen. Bleed air is lead to this membrane with some pressure. The oxygen is kept back and you get air with a significantly smaller fraction of oxygen behind the membrane. There are devices on the marked which produce 2lb/min with up to 1% remaining oxygen

The goal is to have not more than 9-12% in the tank, see the link to NASA above.



By the way: In WW I, Germany sent hydrogen filled airships to England. One could guess just shooting at them would take them down, but the holes were too small to cause a reasonable loss of hydrogen. And unless the bullets made sparks when hitting some steel in the ships, they also did not set the ships on fire. It turned out that firing standard munition at airships was quite useless. 

The solution was to use phosphor based tracker munition which set the hydrogen streaming out of the leaks from the other bullets on fire.