Another thing to add. With the help of my "entity info" plugin I may be able to determine if someone is attacking a construction which belongs to the own team. The colour map (EV_INT_colormap) is the key.
edit: Also found the function "parse_loguser", I'll use it in the next version.
Here are some ideas I got:
detection of TA on engi's buildings
1) Use client commands +attack (-attack for sniper rifle) to a) save CPU time and b) be able to block attacks. Blocking is optional, after all team attack detection is meant to be for servers with friendly fire enabled - a simple announcement or punishment would be the alternatives. Announcment/punishment should be turned off depending on the state of mp_teamplay.
2) Check engineer's player data if it contains the entity number of his buildings. (Otherwise only the team of the buildings can be determined, since the buildings do not link to the engineer.)
AFAIR, this was meant to be done using the function get_user_aiming
. See also one of my other plugins, Entity Info
, which dumps the info about an entity the player is looking at.