Checking what team the attacker is on

[lua]function GM:DoPlayerDeath( ply, attacker, dmginfo )

ply:AddDeaths( 1 )

if ( attacker:IsValid() and attacker:IsPlayer() ) then

	if ( attacker == ply and attacker: ) then
		attacker:GiveAmmo( 6, "Buckshot", true )
	else
	end

end

end [/lua]
In this function I am trying to figure out how to go about checking what team the attacker is on, I only want players on team 2 to be rewarded the 6 buckshots for a kill how should I go about this?

You can just do:
[lua]
function GM:DoPlayerDeath( ply, attacker, dmginfo )

ply:AddDeaths( 1 )   

if ( attacker:IsValid() and attacker:IsPlayer() ) then   

    if ( attacker:Team() == 2 ) then   
        attacker:GiveAmmo( 6, "Buckshot", true )   
    else   
    end   

end   

end
[/lua]
**[Player.Team

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Player.Team)**

Thanks works perfect!