• team.SetUp colors not working
    40 replies, posted
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?[CODE]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) )[/CODE]
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 [CODE]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)[/CODE] then init [CODE]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 [/CODE] then sv_teams [CODE]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 )[/CODE] 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? [B]I want you to tell me where are you seeing the wrong colors? Scoreboard? Chat? WHERE!?[/B]
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." - [url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index6665.html]Wiki[/url] They really need to go a bit more in-depth on the new wiki.
[QUOTE=Internet1001;42343740]"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." - [url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index6665.html]Wiki[/url] They really need to go a bit more in-depth on the new wiki.[/QUOTE] I agree, I still use the old one because I just can't read the new one :/
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!\n" );[/lua]
[QUOTE=Internet1001;42343740]"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." - [url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index6665.html]Wiki[/url] They really need to go a bit more in-depth on the new wiki.[/QUOTE] What else would they need to say here? I think it's as precise as you are going to get.
[QUOTE=James xX;42344091]What else would they need to say here? I think it's as precise as you are going to get.[/QUOTE] [url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index6665.html]This[/url] "outdated" wiki is the most informational one, but the [url=http://wiki.garrysmod.com/page/team/SetUp]new[/url] 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.
[QUOTE=Internet1001;42344195][url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index6665.html]This[/url] "outdated" wiki is the most informational one, but the [url=http://wiki.garrysmod.com/page/team/SetUp]new[/url] 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.[/QUOTE] Instead of bitching you should move info from old to the new.
[QUOTE=Robotboy655;42344230]Instead of bitching you should move info from old to the new.[/QUOTE] Wait, what? I was saying the old one tells you where the function should be used, but the new one does not.
[QUOTE=Internet1001;42344402]Wait, what? I was saying the old one tells you where the function should be used, but the new one does not.[/QUOTE] What part of "Instead of bitching you should improve the new wiki with the info from the old wiki" you did not understand?
[QUOTE=Internet1001;42344195][url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index6665.html]This[/url] "outdated" wiki is the most informational one, but the [url=http://wiki.garrysmod.com/page/team/SetUp]new[/url] 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.[/QUOTE] 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! [url]http://wiki.garrysmod.com/page/Category:Server[/url] [url]http://wiki.garrysmod.com/page/Category:Server_Hooks[/url] [url]http://wiki.garrysmod.com/page/Category:Shared[/url] [url]http://wiki.garrysmod.com/page/Category:Shared_Hooks[/url] [url]http://wiki.garrysmod.com/page/Category:Client[/url] [url]http://wiki.garrysmod.com/page/Category:Client_Hooks[/url]
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!
[QUOTE=Acecool;42344648]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![/QUOTE] You totally fucked up the "new" structure though, it already exits here: [url]http://wiki.garrysmod.com/page/Structures/TextureData[/url] Please look at other examples before you do something. Thanks.
What hell happened here while I was gone? But I do have the team.setup in shared.lua, and both cl_init an init include it. I don't understand why gmod is being such a pain.
Do you do AddCSLuaFile("shared.lua") in your init.lua?
I don't have addcsluafile, but I have include shared.lua in both init and cl_init, and the teams do work, just not their colors.
You must have AddCSLuaFile("shared.lua") in your init.lua, so the shared.lua is sent to client.
[QUOTE=Robotboy655;42345029]You totally fucked up the "new" structure though, it already exits here: [url]http://wiki.garrysmod.com/page/Structures/TextureData[/url] Please look at other examples before you do something. Thanks.[/QUOTE] I didn't do anything wrong with the new structure. I followed the link which was automatically generated by the wiki ( when it was automatically populated, I'm assuming? ) which stated that the structure didn't exist. I then copied the layout from a structure and filled in all of the blanks. Mine looked almost identical to that one you posted except for the order and I didn't put the default color and I even posted an example, that's hardly "fucked up the new structure". So please don't say that I "fucked" something up when I clearly didn't mess up the layout. Ok, so it may have been added twice but the automatically generated link on the wiki which said that it didn't exist should be fixed in the template. Going to see if I can find another one and then edit the template. Next time don't delete it outright, merge it. And, I followed the link which was automatically generated by the wiki for the structure. Those should be fixed. Also, to make it easier, and be on-topic, if you use AddCSLuaFile( ) without any arguments in the file you want the client to download and include it on the server, and then on the client, you don't have to do anything else. ( You can do this because it's shared ) EDIT: Here's another one that points to category instead of structure: [url]http://wiki.garrysmod.com/page/draw/TextShadow[/url] We need to fix it so that arguments point to structures if the categories don't exist? Or make it so that ALL of those are structures and not categories, since a DataType is closer to a structure ( really LOW LEVEL )
So would I put the "AddCSLuaFile ()" in shared.lua, or do "AddCSLuaFile (shared.lua)" in the init.lua?
[QUOTE=Wimoweh;42349631]So would I put the "AddCSLuaFile ()" in shared.lua, or do "AddCSLuaFile (shared.lua)" in the init.lua?[/QUOTE] AddCSLuaFile( ); in shared.lua include( "shared.lua"); in cl_init.lua and init.lua
[QUOTE=Acecool;42349375]I didn't do anything wrong with the new structure. I followed the link which was automatically generated by the wiki ( when it was automatically populated, I'm assuming? ) which stated that the structure didn't exist. I then copied the layout from a structure and filled in all of the blanks. Mine looked almost identical to that one you posted except for the order and I didn't put the default color and I even posted an example, that's hardly "fucked up the new structure". So please don't say that I "fucked" something up when I clearly didn't mess up the layout. Ok, so it may have been added twice but the automatically generated link on the wiki which said that it didn't exist should be fixed in the template. Going to see if I can find another one and then edit the template. Next time don't delete it outright, merge it. And, I followed the link which was automatically generated by the wiki for the structure. Those should be fixed. Also, to make it easier, and be on-topic, if you use AddCSLuaFile( ) without any arguments in the file you want the client to download and include it on the server, and then on the client, you don't have to do anything else. ( You can do this because it's shared ) EDIT: Here's another one that points to category instead of structure: [url]http://wiki.garrysmod.com/page/draw/TextShadow[/url] We need to fix it so that arguments point to structures and not categories?[/QUOTE] Sorry, by "fucked up" I meant "this isn't how it is supposed to be done". If it is a structure, you don't put it's name into the type, because the type is table. Instead we make a link to the structure using {{Struct|MyStructure}}
Sounds good, if I find others like that I'll update. It's just that I followed the link which is automatically set to a Category instead of a structure due to how the template is written. It'd be nice for the wiki to automatically check for Categories first, if not exists then check Structures, if not exists then create a link to both? I appreciate the clarification :-)
This is really pissing me off, it's still not working. I added the AddCSLuaFile in shared, though I don't think it's something like that. I can't find anything else that's changing the team colors. Can you check it and see if I did something wrong unknowingly, if it wouldn't be too much trouble? [URL="https://github.com/ROODAY/redvsblue/tree/master/gamemode"]https://github.com/ROODAY/redvsblue/tree/master/gamemode[/URL]
Sorry, you need to Log In to post a reply to this thread.