Ulysses

General => Developers Corner => Topic started by: Janjakob2000 on March 12, 2015, 11:47:56 AM

Title: Prefixes messed up, need help!
Post by: Janjakob2000 on March 12, 2015, 11:47:56 AM
So I am using a few addons for my server like a prefix addon wich uses this code
Code: [Select]
CreateClientConVar("chat_tags_color_r", 255, true, false)
CreateClientConVar("chat_tags_color_g", 255, true, false)
CreateClientConVar("chat_tags_color_b", 255, true, false)
CreateClientConVar("chat_tags_color_a", 255, true, false)

local Tags =
{
--Group    --Tag     --Color
{"user", "[User] ", Color(212, 67, 255, 255) },
{"admin", "[ADMIN] ", Color(0, 0, 255, 255) },
{"superadmin", "[SUPERADMIN] ", Color(255, 0, 0, 255) },
{"owner", "[OWNER] ", Color(0, 255, 0, 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 )
So I tryed adding a prefix for a different group, then it would like something like this right?
Code: [Select]
CreateClientConVar("chat_tags_color_r", 255, true, false)
CreateClientConVar("chat_tags_color_g", 255, true, false)
CreateClientConVar("chat_tags_color_b", 255, true, false)
CreateClientConVar("chat_tags_color_a", 255, true, false)

local Tags =
{
--Group    --Tag     --Color
{"user", "[User] ", Color(212, 67, 255, 255) },
{"member", "[MEMBER] ", Color(20, 175, 66, 255) },
{"admin", "[ADMIN] ", Color(0, 0, 255, 255) },
{"superadmin", "[SUPERADMIN] ", Color(255, 0, 0, 255) },
{"owner", "[OWNER] ", Color(0, 255, 0, 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 )
Now I go on my server, set myself to this rank, and it doesn't shows up. (the prefix doesn't  show up)
Any help on how to fix this?
Title: Re: Prefixes messed up, need help!
Post by: Caustic Soda-Senpai on March 12, 2015, 02:46:45 PM
Did you restart?
Title: Re: Prefixes messed up, need help!
Post by: Janjakob2000 on March 13, 2015, 02:31:56 AM
Like a thousand times.
Title: Re: Prefixes messed up, need help!
Post by: lynx on March 13, 2015, 02:44:25 AM
Do the other tags work? (admin, superadmin, owner)
Title: Re: Prefixes messed up, need help!
Post by: Janjakob2000 on March 13, 2015, 03:09:50 AM
Yes they do, they work just fine.
Title: Re: Prefixes messed up, need help!
Post by: JamminR on March 13, 2015, 06:06:35 AM
Yes they do, they work just fine.
While you're connected to your srever, from game or server console, do a "ulx who" - that will list all connected players and the group they are in - does it show you as "owner" group. Case sensitive. Can't be "Owner" or another group, would have to be "owner".
Title: Re: Prefixes messed up, need help!
Post by: Janjakob2000 on March 13, 2015, 06:35:37 AM
Yes I have checked my spelling and all that stuff, I set myself to member and it does not have a prefix or something like it.