How do I add my other team to this code?

Hello. For a gamemode I’ve been working on, I’ve run into a problem. I’ve gotten the following code to work, but I need to add it so that it makes the other team(called Rebels, team ID is 2) can also lose. Basically, what I’m trying to do is make them lose the match like the Combine team does, but I want to include it all in one function( I can’t use GM:PlayerDeath twice to make it so that both teams will lose). If you have no idea what I’m talking about with the Combine team, look at the code below.


function GM:PlayerDeath( ply, ent, att )

	timer.Simple( 0, function()
	
	if ply:IsValid() then
	
		ply:SetTeam( TEAM_SPECTATOR )
		ply:Spectate( OBS_MODE_ROAMING )
		
		if team.NumPlayers( 1 ) == 0 then
	
			PrintMessage( HUD_PRINTTALK, "The Rebels Have Won! Changing Map." )
			
			timer.Simple( 5, function() 
			
				ply:ConCommand( "respawn_entities" )
			
			end )
	
		end
		
	end
	
	end)
	end

Just have an elseif check. Something like this?
[lua]if team.NumPlayers( 1 ) == 0 then
PrintMessage( HUD_PRINTTALK, “The Rebels Have Won! Changing Map.” )
timer.Simple( 5, function()
ply:ConCommand( “respawn_entities” )
end )
elseif team.NumPlayers( 2 ) == 0 then
PrintMessage( HUD_PRINTTALK, “The Combine Have Won! Changing Map.” )
timer.Simple( 5, function()
ply:ConCommand( “respawn_entities” )
end )
end[/lua]