Let me show you what your code does by removing the id_team variable:
PHP Code:
new team = (_:cs_get_user_team(victim) == entity_get_edict(ent, EV_ENT_owner));
You are comparing the value of two completely different things, there is no way this does what you want it to. Replace the entity_get_edict call with another cs_get_user_team call.