1) There's a script by LCD that does just that. Check it out in the scripting: beta testing board. It's kinda old so you have to scroll a bit.
2) I'd suggest doing this with an evenhandler, along with a hasweapon check and an array searching for the closest enemy. First had the fire eventhandler, check if anyone is in, say 100 meter distance (kinda silly if you shoot a round 5918312 miles away and they go on alert) and check if the weapon is a silenced weapon.
:beat: *Gets Shot* :beat: