Admin Tags.

I want to have tags to represent admins and super admins. I want the tags to be before the players name and in specific colors. How can I do this? Here is what I tried but it put the admin tag in their sentence.

[lua]
function pltag( ply, text, toall )

if ply:IsAdmin() then

    return "[Admin]".. text

elseif ply:IsSuperAdmin() then

return "[Super]".. text

end
hook.Add( “PlayerSay”, “pltags”, pltag )
[/lua]

You’re gonna have to mimic the chat messages with chat.AddText. Lemme write you an example script.

Thanks.

Something like this, doesn’t take care of aliveness and team chat though, but you should be able to do that yourself from here. It’s completely clientside by the way.

[lua]hook.Add( “OnPlayerChat”, “AdminTags”, function( ply, text, teamchat, alive )
if ( ply:IsAdmin( ) ) then
chat.AddText( color_white, "[ADMIN] ", team.GetColor( ply:Team( ) ), ply:Nick( ), color_white, ": " … text )
return true
end
end )[/lua]

Thanks.

Snip

What the fuck, go make your own thread next time. http://wiki.garrysmod.com/?title=Locations