team.SetUp colors not working

So I have three teams, Red, Green, and Blue. But the team.SetUp Color(x,x,x,x) doesn’t work. Red team gets a bright blue, Blue team gets orange, and Green team gets pink, and I don’t see anywhere else in the code that says team.Setup(blah blah blah). What’s wrong?


team.SetUp( 1, "Red", Color( 255, 15, 15, 255) )
team.SetUp( 2, "Blue", Color( 15, 15, 255, 255) )
team.SetUp( 3, "Green", Color( 15, 155, 15, 255) )
team.SetUp( 4, "Joining", Color( 50, 50, 50, 255) )
team.SetUp( 5, "BOT", Color( 50, 50, 50, 255) )

Show how you retrieve the color and how you use it.

What do you mean? The way the code is used is in my team codes, which are these:

Cl_init.lua


include( 'shared.lua' )

function set_team()
 
local frame = vgui.Create( "DFrame" )
frame:SetPos( ScrW() / 2, ScrH() / 2 ) --Set the window in the middle of the players screen/game window
frame:SetSize( 150, 300 ) --Set the size
frame:SetTitle( "Select Your Team!" ) --Set title
frame:SetVisible( true )
frame:SetDraggable( false )
frame:ShowCloseButton( true )
frame:MakePopup()
 
team_1 = vgui.Create( "DButton", frame )
team_1:SetPos( frame:GetTall() / 4, 5 ) --Place it half way on the tall and 5 units in horizontal
team_1:SetSize( 150, 100 )
team_1:SetText( "Red Army!" )
team_1.DoClick = function() --Make the player join team 1
    RunConsoleCommand( "red" )
	frame:Remove()
	team_1:Remove()
	team_2:Remove()
	team_3:Remove()
end
 
team_2 = vgui.Create( "DButton", frame )
team_2:SetPos( frame:GetTall() / 4, 105 ) --Place it next to our previous one
team_2:SetSize( 150, 100 )
team_2:SetText( "Blue Army!" )
team_2.DoClick = function() --Make the player join team 2
    RunConsoleCommand( "blue" )
	frame:Remove()
	team_1:Remove()
	team_2:Remove()
	team_3:Remove()
end

team_3 = vgui.Create( "DButton", frame )
team_3:SetPos( frame:GetTall() / 4, 205 ) --Place it next to our previous one
team_3:SetSize( 150, 100 )
team_3:SetText( "Green Army!" )
team_3.DoClick = function() --Make the player join team 2
    RunConsoleCommand( "green" )
	frame:Remove()
	team_1:Remove()
	team_2:Remove()
	team_3:Remove()
end
 
end
concommand.Add( "team_menu", set_team )
usermessage.Hook("team_menu", set_team)

then init


function GM:PlayerSpawn( ply )
    self.BaseClass:PlayerSpawn( ply )   
 
    ply:SetGravity  ( .65 )  
    ply:SetMaxHealth( 100, true )  
 
    ply:SetWalkSpeed( 325 )  
    ply:SetRunSpeed ( 325 ) 
 
end

function GM:PlayerLoadout( ply )

	ply:StripWeapons()

	if ply:Team() == 1 then
		ply:Give( "weapon_ttt_ma5b" )
		ply:Give( "weapon_ttt_halosword" )
		ply:Give( "weapon_ttt_m6d" )
		ply:SetModel( "models/player/masterchiefh2_red.mdl" )
	end

	if ply:Team() == 2 then
		ply:Give( "weapon_ttt_ma5b" )
		ply:Give( "weapon_ttt_halosword" )
		ply:Give( "weapon_ttt_m6d" )
		ply:SetModel( "models/player/masterchiefh2_blue.mdl" )
	end
	
	if ply:Team() == 3 then
		ply:Give( "weapon_ttt_ma5b" )
		ply:Give( "weapon_ttt_halosword" )
		ply:Give( "weapon_ttt_m6d" )
		ply:SetModel( "models/Halo4/masterchief_player.mdl" )
	end
	
end

function GM:PlayerInitialSpawn( ply )
	   ply:PrintMessage( HUD_PRINTTALK, "Welcome to Red Vs. Blue, Spartan " .. ply:Name() .. "!" )
	   ply:SetTeam( 4 )
	   ply:ConCommand( "team_menu" )
end


then sv_teams


function red ( ply )
	ply:SetTeam( 1 )
		ply:Spawn()
		ply:SetModel( "models/player/masterchiefh2_red.mdl" )
		ply:PrintMessage( HUD_PRINTTALK, "Welcome to Red Team, Spartan " .. ply:Name() .. "!" )
end

function blue ( ply )
	ply:SetTeam( 2 )
		ply:Spawn()
		ply:SetModel( "models/player/masterchiefh2_blue.mdl" )
		ply:PrintMessage( HUD_PRINTTALK, "Welcome to Blue Team, Spartan " .. ply:Name() .. "!" )
end

function green ( ply )
	ply:SetTeam( 3 )
		ply:Spawn()
		ply:SetModel( "models/Halo4/masterchief_player.mdl" )
		ply:PrintMessage( HUD_PRINTTALK, "Welcome to Green Team, Spartan " .. ply:Name() .. "!" )
end

function GM:ShowTeam( ply ) -- This hook is called everytime F2 is pressed.
    umsg.Start( "team_menu", ply ) -- Sending a message to the client.
    umsg.End()
end --Ends function

concommand.Add( "red", red )
concommand.Add( "blue", blue )
concommand.Add( "green", green )

and the team.setups from before are in my shared.lua. I don’t see anything overwriting them though.

Exactly where the colors are are incorrect and how you retrieve the colors there?

I don’t know, there is nowhere else that calls team colors except for the one in the op, and yet the colors all off. Red is blue instead of red, blue is orange instead of blue and green is pink instead of green. I even changed the values to see if it was using something other than RGBA, but they stayed the same. I don’t know why.

OMG, Can’t you understand what am I saying?

I want you to tell me where are you seeing the wrong colors? Scoreboard? Chat? WHERE!?

Oh I’m sorry, I actually didn’t. (No sarcasm, I seriously didn’t understand what you were asking) the issues arise in chat, as the scoreboard is still default sandbox atm. The chat colors for the teams are what’s not working.

And the team.SetUp functions are called both, on the server and client?

“You need to set the team up on both the client and the server. This would ideally be achieved by defining your team-setup’s in your gamemode’s shared file.”

  • Wiki
    They really need to go a bit more in-depth on the new wiki.

I agree, I still use the old one because I just can’t read the new one :confused:

Running this code works flawlessly. It prints the text in RED, which is what was set up as the team-color. As said before, you need to set it up on the CLIENT and on the SERVER, otherwise it will not work.

[lua]MY_TEAM = 1;

// team.SetUp( number teamIndex, string teamName, Color teamColor, boolean teamJoinable ) // Just because you set a team as non-joinable, doesn’t mean you can’t use PLAYER:SetTeam( MY_TEAM ) on the server.
team.SetUp( MY_TEAM, “My Team”, Color( 255, 0, 0, 255 ), false );

// team.GetColor( number teamIndex )
MsgC( team.GetColor( MY_TEAM ), "My Team Color is RED!
" );[/lua]

What else would they need to say here? I think it’s as precise as you are going to get.

This “outdated” wiki is the most informational one, but the new wiki does not say anything about where the function resides. There’s a “realm” section in the function editing form, but it’s never actually shown anywhere on the wiki page. Kind of pointless, really.

Instead of bitching you should move info from old to the new.

Wait, what? I was saying the old one tells you where the function should be used, but the new one does not.

What part of “Instead of bitching you should improve the new wiki with the info from the old wiki” you did not understand?

If you look at the BOTTOM of the page, it will say something like:

Client Functions, Client Hooks, Client, Shared Functions, Shared Hooks, Shared, Server Functions, Server Hooks, Server.

Realm is in the new Wiki and it gives you a link to VIEW ALL of them!

I am an idiot. And also blind.

I just added a new DataType/Structure today, and updated a function. If everyone updates something once a week, or so, we can get this Wiki slam packed full of information really quickly!

You totally fucked up the “new” structure though, it already exits here: http://wiki.garrysmod.com/page/Structures/TextureData

Please look at other examples before you do something. Thanks.