Quick question with team.GetAll

Hey,

Im just asking a quick question with Derma and teams.

when I do a for loop with all the teams, it comes up with teams I dont want to see, like Joining/Connecting, unassigned etc.



	local DTeamChoice = vgui.Create("DComboBox", base)
	
	
	DTeamChoice:SetSize(100,30)
	DTeamChoice:SetPos(5, 130)
	for k, v in pairs(team.GetAllTeams()) do
		DTeamChoice:AddChoice(team.GetName(k))
	end


Is there a way to remove them and show all other teams. (besides removing them from gmod, because that would be stupid.)

Thanks in advance.

Add


if ( k == TEAM_SPECTATOR ) then continue; end

– or something similar for the teams you want to hide. You could also turn it into a table…


//
// Outside of the function
//
local HIDDEN_TEAMS = {
	[ TEAM_SPECTATOR ] = true;
	[ TEAM_UNASSIGNED ] = true;
};

// In the loop
if ( HIDDEN_TEAMS[ k ] ) then continue; end

Thanks so much dude, except I had to add an exlamation mark before ( HIDDEN_TEAMS[k] )