BF2:Friendly Fire

From BattleWiki

Sometimes teammates will have their names appear above them in red onscreen. Don't go by the red name color. Go by the player model. USMC have light-colored uniforms. MEC have a darker, camo-striped looking sort of uniform. At first they look very similar, but after playing a bit it's fairly easy to tell them apart. If you start shooting someone with a red name and a teammate yells at you to stop, then stop. You've probably hit the bug. It's pretty common, unfortunately. This bug can even make people show up on the wrong side of the scoreboard, so the player model method is probably the only way to be sure.

Actually, that's not true. In extreme cases, other bugs may even trigger the wrong player models, or else inaccurate detection of teamkills. However, during normal play, watching the model is probably good enough.

This bug can also occur in reverse: Enemies will appear as teammates, or even squadmates. Killing them triggers a [teamkills] message, but points are not deducted from your teamplay score. Also, like teammates, the nametags of enemies affected by this bug will be visible through walls!

A workabout to this bug is to exit the game by pressing ESC and then reentering the game (again ESC).

As of the 1.12 patch, this bug is still present.