how to add tags to chat?

how to add tags to chat?

Example:

(Owner) Victi: hello

You need to use the PlayerSay hook, then a usermessage to send the text, player and rank to clients. When the usermessage is recieved, use chat.AddText to display it in the chat.

It’s how I did it anyway :slight_smile:

http://www.facepunch.com/showthread.php?t=758899

You can do it completely client side as well.

I got it working but…

http://img32.imageshack.us/img32/613/gmconstruct0077.jpg

i will have it like the picture shows

The code



function Said( ply, text, toall )
if ply:IsSuperAdmin() then
return "(Owner)" .. text
   end
end

hook.Add( "PlayerSay", "Said", Said )


[lua]
local function OnPlayerChat( pl, text )

if( !pl:IsSuperAdmin( ) ) then return; end

local clr = team.GetColor( pl:Team( ) );
chat.AddText( clr, pl:Name( ), clr, " (Owner)", color_white, ": "..text );

return true;

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

Is returning true necessary Nevec? If he had any other stuff using OnPlayerChat it would break it, if you return anything with that hook.

To override the original message, yes.

it don’t works

i just get a normal chat tag :confused:

http://img17.imageshack.us/img17/613/gmconstruct0077.jpg

Edit

Got it Working :wink:

-snip-

Oh, duh.

Works perfectly for me. Thanks Nevec.

How did you get it too work? I get the time when i change it to what nevec said.

I got it, wonder if you could also draw an image instead of some text.

can you paste the code you used?

Mine is just a time.

Broke for me, when I tried adding more then one group. Hehe.

Gonna figure this out.

[editline]09:42PM[/editline]

Can’t really get clients to see it, maybe I just gotta slap it in the gamemode lua.

[editline]10:04PM[/editline]

Only works with the person who is actually in that group (Admin, SuperAdmin) however regular clients or people below that class can not see that next to the actual persons name.