Or you can exercise some restraint and not kill your teammate. If you are using a weapon that will most likely kill your teammate, just don't do it. If you really want to help, you do have a weaker melee attack that WONT kill your ally.
You do realize that's the worst possible advice you can ever give when it comes to how to support teammates in melee as a tactical? You want people to start meleeing into you - staggering you and leaving you both easy prey for your enemy? The solution to the problem of people shooting teammates stuck in melee is solved by one, simple skill that anyone can pick up as long as they set their sensitivity correctly and learn routes of attack so they can line up their sights there: Good Aim. And if you can't aim, move on. Leave the team mate to deal with it. If it's a point capture situation - shoot anyway, a random no-name team mate isn't as valuable as the capture point.
I'm answering to the prospect of using splash damage weapons like rokkits and tempest launchers to assist players who are in melee.
Even then, using the splash to ensure that a skilled melee player dies is far, far superior to rushing into melee with a knife and causing the death of your team mate and yourself, you're often better off just blowing the pair up TBH.
Or you could attack the enemy's back from the opposite side, putting the foe between the two of you and thus avoid hitting your ally altogether, like a sensible human being would.
Not being funny, but that's extremely difficult (for pubs) outside of 1v2 situations, at which point you should be able to shoot the enemy without incident. In team fights, say, 7v7 or more moving onto a point - that's much easier said than done.
In a 7v7, there are other targets you shopuld probably be focusing on. Namely the 2 or three of the enemy's buddies that are going to all be shooting your teammate while he's in melee.
Smart man im using same tactics or use back attack or side to help . but some players shot u in the back to kill enemy using u as shield for point. the greed is to much