Modifying this code to be team based?

Im trying to get this part of the code to check if just a certain team has 0 players rather than if everyone is dead. Only problem is I cant figure it out. Ive tried team.NumPlayers( TEAM_GUEST ) in there but it still doesnt work.

[LUA]DeathCheck = function(pl, attacker, dmginfo)
if R.Round == 1 then
local dead = 0
for k, v in pairs(player.GetAll()) do
if !v:Alive() then
dead = dead+1
end
end

        if dead >= #player.GetAll() then
            R.NewRound()
        end
    end
end
hook.Add("PlayerDeathThink", "deathcheck.", DeathCheck)[/LUA]

team.NumPlayers returns the number of players in that team, regardless if they are dead or not.

So what do i use instead

Are you trying to check if a team has 0 players alive, or literally 0 players in it?

To be honest it would actually be nice to know both because there are 2 different situations where i need both of those ^^

Check if team has 0 players IN it.
team.NumPlayers(team_index)
#team.GetPlayers(team_index)
Check if a team has 0 players alive.



local numDead = 0
for k,v in pairs(team.GetPlayers(team_index)) do
if(not v:Alive()) then
numDead = numDead + 1
end
end
if(numDead == team.NumPlayers(team_index)) then
--Do stuff
end


Hey cool that works perfectly. Thank you