Take a look at the attached missionette.
Play it through a few times and you'll notice that the
detected by trigger doesn't fire immediately even if they see you and start firing in your direction, so on its own it's not the best solution.
You'll see that there's an eventhandler assigned to the player (check
this tutorial) which detects if the weapon fired wasn't silenced. That in itself is also not fool-proof because a) it gets activated even if the player is miles away from anyone, and b) also fires if the player sets a satchel charge or a mine - not the loudest activity by any means.
Hopefully you'll also see that with a combination of these things you can get pretty close to what you want to achieve, and that the answers are all here on OFPEC - you just need to do a bit of searching and experimenting in the editor.