• GMOD Prop Hunt Player Chat Tags 2.5 Issue.
    8 replies, posted
So, I just recently added this to my friend's server and set it up. LINK: [url]http://forums.ulyssesmod.net/index.php/topic,6196.0.html[/url] Now, it works beautifully except for one issue I have. Here is my current code: [CODE]--Chat Tags by Tyguy CreateClientConVar("chat_tags_color_r", 255, true, false) CreateClientConVar("chat_tags_color_g", 0, true, false) CreateClientConVar("chat_tags_color_b", 0, true, false) CreateClientConVar("chat_tags_color_a", 255, true, false) local Tags = { --Group --Tag --Color {"admin", "[Admin] ", Color(0, 0, 255, 255) }, {"superadmin", "[Lead Admin] ", Color(255, 0, 0, 255) }, {"owner", "[Owner] ", Color(0, 255, 0, 255) }, {"moderator", "[Moderator] ", Color(0, 255, 0, 255) }, {"user", "[User] ", Color(255, 255, 255, 255) } } hook.Add("OnPlayerChat", "Tags", function(ply, strText, bTeamOnly) if IsValid(ply) and ply:IsPlayer() then for k,v in pairs(Tags) do if ply:IsUserGroup(v[1]) then local R = GetConVarNumber("chat_tags_color_r") local G = GetConVarNumber("chat_tags_color_g") local B = GetConVarNumber("chat_tags_color_b") local A = GetConVarNumber("chat_tags_color_a") local nickteam = team.GetColor(ply:Team()) if !bTeamOnly then chat.AddText(v[3], v[2], nickteam, ply:Nick(), color_white, ": ", Color(R, G, B, A), strText) return true else chat.AddText(v[3], v[2], nickteam, "(TEAM) ", ply:Nick(), color_white, ": ", Color(R, G, B, A), strText) return true end end end end if !IsValid(ply) and !ply:IsPlayer() then local ConsoleColor = Color(0, 255, 0) --Change this to change Console name color chat.AddText(ConsoleColor, "Console", color_white, ": ", strText) return true end end )[/CODE] As you can see, everything is fine. The only issue I have which I cannot figure out for the life of me is that any group that is assigned a tag has red text in chat. To make it easier to understand. I have the owner tag set for myself. The owner tag shows up green, along with my name as red or blue depending on whether I'm prop or hunter. Then, the actual text of what I say is red. So if I said "Hello" It would be red. I am not sure how to fix this, but I would like it to be the default white as it is when the group is not assigned a tag.
Please read your code again.. You set your text color to red. [CODE] CreateClientConVar("chat_tags_color_r", 255, true, false) CreateClientConVar("chat_tags_color_g", 0, true, false) CreateClientConVar("chat_tags_color_b", 0, true, false) CreateClientConVar("chat_tags_color_a", 255, true, false) chat.AddText(v[3], v[2], nickteam, ply:Nick(), color_white, ": ", Color(R, G, B, A), strText) chat.AddText(v[3], v[2], nickteam, "(TEAM) ", ply:Nick(), color_white, ": ", Color(R, G, B, A), strText) [/CODE]
[QUOTE=Avoidy;45547052]Please read your code again.. You set your text color to red. [CODE] CreateClientConVar("chat_tags_color_r", 255, true, false) CreateClientConVar("chat_tags_color_g", 0, true, false) CreateClientConVar("chat_tags_color_b", 0, true, false) CreateClientConVar("chat_tags_color_a", 255, true, false) chat.AddText(v[3], v[2], nickteam, ply:Nick(), color_white, ": ", Color(R, G, B, A), strText) chat.AddText(v[3], v[2], nickteam, "(TEAM) ", ply:Nick(), color_white, ": ", Color(R, G, B, A), strText) [/CODE][/QUOTE] I never set that, it came like that and I am not a coder, I didn't know what that means.
-snip-
[QUOTE=AnonTakesOver;45547311][code] --Chat Tags by Tyguy CreateClientConVar("chat_tags_color_r", 255, true, false) CreateClientConVar("chat_tags_color_g", 0, true, false) CreateClientConVar("chat_tags_color_b", 0, true, false) CreateClientConVar("chat_tags_color_a", 255, true, false) local Tags = { --Group --Tag --Color {"admin", "[Admin] ", Color(0, 0, 255, 255) }, {"superadmin", "[Lead Admin] ", Color(255, 0, 0, 255) }, {"owner", "[Owner] ", Color(0, 255, 0, 255) }, {"moderator", "[Moderator] ", Color(0, 255, 0, 255) }, {"user", "[User] ", Color(255, 255, 255, 255) } } hook.Add("OnPlayerChat", "Tags", function(ply, strText, bTeamOnly) if IsValid(ply) and ply:IsPlayer() then for k,v in pairs(Tags) do if ply:IsUserGroup(v[1]) then local nickteam = team.GetColor(ply:Team()) if !bTeamOnly then chat.AddText(v[3], v[2], nickteam, ply:Nick(), color_white, ": ", Color(0, 0, 0, 255), strText) return true else chat.AddText(v[3], v[2], nickteam, "(TEAM) ", ply:Nick(), color_white, ": ", Color(0, 0, 0, 255), strText) return true end end end end if !IsValid(ply) and !ply:IsPlayer() then local ConsoleColor = Color(0, 255, 0) --Change this to change Console name color chat.AddText(ConsoleColor, "Console", color_white, ": ", strText) return true end end ) [/code][/QUOTE] Just tested it, you managed to change the color, but now it's black.
[QUOTE=sk8ters24;45547328]Just tested it, you managed to change the color, but now it's black.[/QUOTE] damn, I always get them two colors mixed, change the Color(0, 0, 0, 255) under chat.AddText to Color(255, 255, 255, 255), apologies. [code] local Tags = { --Group --Tag --Color {"admin", "[Admin] ", Color(0, 0, 255, 255) }, {"superadmin", "[Lead Admin] ", Color(255, 0, 0, 255) }, {"owner", "[Owner] ", Color(0, 255, 0, 255) }, {"moderator", "[Moderator] ", Color(0, 255, 0, 255) }, {"user", "[User] ", Color(255, 255, 255, 255) } } hook.Add("OnPlayerChat", "Tags", function(ply, strText, bTeamOnly) if IsValid(ply) and ply:IsPlayer() then for k,v in pairs(Tags) do if ply:IsUserGroup(v[1]) then local nickteam = team.GetColor(ply:Team()) if !bTeamOnly then chat.AddText(v[3], v[2], nickteam, ply:Nick(), color_white, ": ", Color(255, 255, 255, 255), strText) return true else chat.AddText(v[3], v[2], nickteam, "(TEAM) ", ply:Nick(), color_white, ": ", Color(255, 255, 255, 255), strText) return true end end end end if !IsValid(ply) and !ply:IsPlayer() then local ConsoleColor = Color(0, 255, 0) --Change this to change Console name color chat.AddText(ConsoleColor, "Console", color_white, ": ", strText) return true end end ) [/code]
[QUOTE=AnonTakesOver;45547338]damn, I always get them two colors mixed, change the Color(0, 0, 0, 255) under chat.AddText to Color(255, 255, 255, 255), apologies. Edited original post.[/QUOTE] Thanks!
[QUOTE=sk8ters24;45547345]Thanks![/QUOTE] I haven't really used the chat.AddText function, and I can't test it now, but you may not even need the Color(255, 255, 255, 255) before strText since you are already setting it to white, I changed the color again to white just to make sure.
[QUOTE=AnonTakesOver;45547392]I haven't really used the chat.AddText function, and I can't test it now, but you may not even need the Color(255, 255, 255, 255) before strText since you are already setting it to white, I changed the color again to white just to make sure.[/QUOTE] Yeah it works now with setting it to 255, 255, 255, 255. Thanks for the help.
Sorry, you need to Log In to post a reply to this thread.