When Z key is kept down and then X key, it keeps spawning things, but also when X key is kept down first and then Z key it keeps spawning something else?

Hello, I have a shooting system for my game.
When I hold X key down, it fires forward, and when I hold Z it fires behind the ship.

How could I make that when I first hold X to shoot forward, I then hold down both X and Z to shoot different ammo forward?

And when I hold Z, and then Z and X it shoots different ammo behind it?

Here is an image that I hope helps to demonstrate what I mean