I've created a script that does what you want, but unfortunately I'm at work now and haven't got a copy. If you want I can post you a copy when I get home tonight (7-8 hours from now).
The script needs a lot of work to make it usable on multiple units but at the moment it works via an addaction on a named target unit. The target has no ammo so can't shoot you, but he has another script which allows him to attack you with his rifle butt.
Both scripts use the appropriate animations (strokefist and strokerifle) and a custom sound and if the target unit is within a set distance (1.5 m for fist, 2m for the rifle) then the attack succeeds and causes a random amount of damage between 0 and 100%. Dead simple I know but that's why i'm still working on it !
Best of all, the target has a THIRD script attached to him which allows the player to duck the target's attacks. The script runs an animation (stand to crouch) and sets a global variable for 1 second that negates any enemy attack. With a bit of luck and good reflexes you can activate it just as the bad guy starts his swing, then you have four seconds to pelt him with your fists before he swings again. Neat !
I have tested it a number of times and sometimes I get into the groove and kill him no probs. Other times I stuff my timing completely and end up getting whacked from here to Sunday ! (If either side actually connects then the script plays a "go to crouch" animation so you get knocked down for a sec - even if you're dead ! Oddly fascinating watching the bad guy work your body over :beat: ).
As I said, at the moment the scripts refer to named units but when I get a free second I am going to make it refer to the generic units (ie - the attacker, the target etc) so I can add it to dozens of enemy. I also want to tweak it so that I can add it to fully armed units - if the player is within 5m or so then they won't shoot but will instead try to swing at him. This should make trying to sneak up on baddies a legitimate tactic !
Cheers !