If you've been watching the news lately you have no doubt seen the reports about innocent bystanders who were responding to an active shooter event with their firearms when they were shot to death by responding law enforcement by mistake (examples here and here).
This is a very good reminder that if you are in an active shooter situation and you are a civilian and you pull out your firearm to confront the shooter, there is a very good chance that when law enforcement rolls up they could mistake you for the shooter. The police only know what they are told--male with a gun, black male with a gun--and if you happen to be a male with a gun or a black male with a gun the police will automatically think that you are the shooter and with current protocols, law enforcement tends to shoot first and ask questions later. Ditto if they come up on the scene with no description--anyone wielding a gun will look like the shooter. And even if you are a female with a gun and the description is a male with a gun, well, in the midst of chaos, your guess is a good as mine when it comes to how the officers will respond.
There is a reason that when law enforcement (police, FBI, Interpol, whoever) go into situations where there could be shooting activity, they wear jackets with giant letters on them identifying what agency they are responding with, kind of a "I'm with the good guys, don't shoot me" sort of thing.
So where does this leave the good guy with a gun? On the one hand, good on you for trying to avert a deadly situation. On the other hand, how will you let the police know you are the good guy with a gun and not the active shooter? There is no good answer to this, unfortunately. You can try calling dispatch (911) to identify yourself but that is sort of hit or miss in a chaotic situation (your message may not be relayed, or may not be relayed accurately to responding officers). You can holster your weapon and get out of the area when you hear sirens coming your way (if you are in the midst of a shoot out obviously this won't work well, also if law enforcement responds without sirens you won't know they are coming). You can drop your weapon when you see law enforcement and raise your hands so they know you aren't a threat (if the shooter is targeting you at that moment it isn't a good time to drop your weapon). You can yell to the cops that you aren't the shooter and tell them who and where the actual shooter is (easier said than done in a chaotic situation).
Needless to say, this is something to give some consideration to before you end up in such a situation and there is no right answer that will protect you in the midst of chaos. Be aware of what's happening, remember that a gun in anyone's hand is taken as a threat to law enforcement, and try somehow to identify yourself if you ever find yourself in such a situation. If I find a better answer to this conundrum than what I have written here, I'll let you know.