Problem with Chat Tags

Not really any errors in this one (Bummed off another thread):
http://www.facepunch.com/showthread.php?t=773810

Tried to implement my own way:
[lua]local function OnPlayerChat( pl, text )
local clr = team.GetColor( pl:Team( ) );
if( !pl:IsUserGroup(“vip”) ) then return; end

if( pl:IsUserGroup("owner") ) then
	chat.AddText( Color(165, 200, 240, 255), "(Owner) ", clr, pl:Name( ), color_white, ": "..text );
	return true;
end
if( pl:IsUserGroup("admin") ) then
	chat.AddText( Color(45, 75, 100, 255), "(Admin) ", clr, pl:Name( ), color_white, ": "..text );
	return true;
end
if( pl:IsUserGroup("vip") ) then
	chat.AddText( Color(220, 220, 15, 255), "(VIP) ", clr, pl:Name( ), color_white, ": "..text );
	return true;
end

end
hook.Add( “OnPlayerChat”, “AddChatTags”, OnPlayerChat );[/lua]

Gives no errors, works. But the problem is only people who are in the user group can see that next to their name or others who are in the same usergroup. If they’re not in the group they just see others name without anything next to it.

I have the feeling that the hook may be messed up in that the pl argument is the LocalPlayer, not the player that’s chatting. Or does it work otherwise? I’m not really sure.

Either way, I think it’ll probably work if you use Overv’s serverside chat.AddText function on the PlayerSay hook.

No, pl is the player chatting. You could test this by using print(pl:Nick()) of course.

A serverside version is alot better, since you can do so much more with it.

Where would I find it? Or figure it out.

Edit: I wish there was a post delete button so I don’t have to triple post.

[editline]01:13PM[/editline]

[lua]if (CLIENT) then
local function OnPlayerChat( pl, text )
local clr = team.GetColor( pl:Team( ) );

if( pl:IsUserGroup("owner") ) then
	chat.AddText( Color(165, 200, 240, 255), "(Owner) ", clr, pl:Name( ), color_white, ": "..text );
	return true;
end
if( pl:IsUserGroup("admin") ) then
	chat.AddText( Color(45, 75, 100, 255), "(Admin) ", clr, pl:Name( ), color_white, ": "..text );
	return true;
end
if( pl:IsUserGroup("vip") ) then
	chat.AddText( Color(220, 220, 15, 255), "(VIP) ", clr, pl:Name( ), color_white, ": "..text );
	return true;
end

end
hook.Add( “OnPlayerChat”, “AddChatTags”, OnPlayerChat );
end
[/lua]

Brings me back to where I started. Can anyone explain to me how I would implement Overv’s serverside chat.AddText or make the script for clients get all the players and display the ranks next to their name globally (In chat)?