• team.SetUp colors not working
    40 replies, posted
You have this in shared.lua [lua]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) )[/lua] Pasting this right after works fine and shows the proper color.: [lua]MsgC( team.GetColor( 1 ), "My Team Color is RED!\n" ); MsgC( team.GetColor( 2 ), "My Team Color is BLUE!\n" ); MsgC( team.GetColor( 3 ), "My Team Color is GREEN!\n" ); MsgC( team.GetColor( 4 ), "My Team Color is GRAY!\n" ); MsgC( team.GetColor( 5 ), "My Team Color is GRAY!\n" );[/lua] Make sure you're not setting up those vars anywhere else. Also, the joining team is set as UNASSIGNED / SPECTATOR, you don't need to "add" those. Use ENUMs when they're set. [lua]function PLAYER:Unassigned( ) if ( self:Team( ) == TEAM_UNASSIGNED || self:Team( ) == TEAM_SPECTATOR ) then return true; end return false; end[/lua] You also added: AddCSLuaFile( "shared.lua" ) in init.lua, which is right. Make sure all folders and file-names are lowercase, especially if you're running linux.
Ok thanks, I'll implement those after school tomorrow. [editline]29th September 2013[/editline] Also, would I add the player un assigned function in init.lua?
Completely up to you; it's one of my custom functions which essentially checks if a player is inbound / connecting / spectator / not-in-game. But, the reason I posted it was to show you that ENUMs exist for certain teams already, and those should be used before creating a new one. If you do, make sure you set up the meta-table. PLAYER = FindMetaTable( "Player" );
what do you mean set up the meta-table, just put the code you posted withe the PLAYER = FindMetaTable( "Player" ) as well, or do I add more? [editline]30th September 2013[/editline] OMG it's still not working! I didn't expect it to but still! I don't what the hell my error is! Red team gets blue team color, blue gets orange, and green gets pink! And changing the colors still leave it at those! WTF?! This seriously bugging me considering that a damn basic line part of gmod won't damn work! [URL="https://www.dropbox.com/s/g25kebj5mmy4lyn/2013-09-30_00004.jpg"]https://www.dropbox.com/s/g25kebj5mmy4lyn/2013-09-30_00004.jpg[/URL] Thats the screenshot. As you can see, the colors are not right. Red team, even though its Color(255,15,15,255) gets blue, blue, which is Color(15,15,255,255) gets orange, and green which is Color(15,155,15,255) gets pink. What is going on?
You better post zip of your gamemodr because we wont be able to see what you did wrong otherwise.
I posted the github before, but here it is again:[URL="https://github.com/ROODAY/redvsblue"]https://github.com/ROODAY/redvsblue[/URL]
1) Why on earth do you have SO MUCH empty files in your gamemode. Remove them. 2) You AddCSLuaFile the shared.lua twice. Remove one in either shared.lua or init.lua 3) Try putting your team.SetUp functions in this gamemode hook/function: [url]http://wiki.garrysmod.com/page/GM/CreateTeams[/url]
i have the empty files just so I know what to do later on so I don't forget, but they don't cause anything more serious than "could not include file." Also, do I put the whole team.setup line in GM.CreateTeam or just the values like ( 1, "Red", Color(x,x,x,x) )? [editline]1st October 2013[/editline] I see it says Teams as in plural, so do I do GM:CreateTeams() { 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) ) } or something else?
[code]function GM:CreateTeams() 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) ) end[/code] [editline]1st October 2013[/editline] If you can't keep track of "what to do", use Google Keep or Google Docs and write everything down. Helps a ton. Creating empty files is a very dumb idea.
noted. [editline]1st October 2013[/editline] OMG I F*CKING LUV YOU IT WORKS NOW! [editline]1st October 2013[/editline] yayayayayayayayayayaya! [editline]1st October 2013[/editline] How do I set this as solved?
Top right corner i think.
Sorry, you need to Log In to post a reply to this thread.