Disallow Team on certain team damage

How would disable damage from one team, to another.

[lua]
function TeamDamage( ent, inflictor, attacker, dmg, dmginfo )

if not ent:IsPlayer() or not attacker:IsPlayer() then return end

if ( ent:Team() == FIRST_TEAM_HERE or ent:Team() == SECOND_TEAM_HERE ) and ( attacker:Team() == FIRST_TEAM_HERE or attacker:Team() == SECOND_TEAM_HERE ) then

     dmginfo:SetDamage( 0 )

end

end
hook.Add( “EntityTakeDamage”, “TeamDamage”, TeamDamage )
[/lua]

Goes in any serverside Lua file.
Replace FIRST_TEAM_HERE and SECOND_TEAM_HERE with the two teams you don’t want to be able to attack each other.