Shooting from secondary weapon and from machine gun doesn't work. (ground forces)

I’ve noticed that whenever i select my secondary weapon or machine gun and fire from it, it will immediately swap back to my main gun, to clarify my secondary weapon is set to " Z " and my machine gun set to " \ " with my weapon reset button as " ` " with the button i use to fire with obviously being left mouse button and once i press it i will swap back to my main gun, i dont know why this happens so any useful suggestions will be appreciated.