Chat Color

A simple script that allows you to change the text color that you say. You say a color in the chat and then whatever you type after that will be that color. Example: “/red Sup”.
The available colors are:

/red
/blue
/green
/yellow
/orange
/pink
/purple

You can also use capitalized color names (Example: /RED)

Feel free to post any new colors (with RGB) or suggestions you can offer.

http://www.garrysmod.org/img/?t=dll&id=87973

Screenshots:

http://img194.imageshack.us/img194/1055/gmconstruct0037.jpg

Not sure what I would use this for, it is good though.

You made the little : the colour too :C
Other than that, good work!

Does the player’s name also change based on the team’s color?

The player’s name already changes based on the team’s color. That’s why my name was yellow in the screenshot.

Nice script. I’m running it on my zs server. Noobs keep asking “OMG HOW DO YOU TALK IN RED?!”.

This is actually amusing to use, are you going to add more colors, it’s really narrow.

Haha, nice one.

If I type /red text in chat, it will say “darastrix: /red text” and then “darastrix: text” with text being red for me, but no one else, maybe it’s because I was in a darkRP server?

Finally, something you didn’t steal from another server, Warbasher.

I love the super grav gun reskin.

How about adding /colour(255,255,255,255) Text goes here
As in a custom RGB code

You have my download! good job!

You might consider using **[String.lower

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=String.lower)** on the text after the prefix, so as to avoid repeating code for two different cases.

anyway to automatic set this to standard for the ones i specify? (Owner)

Can you let us put colors in the middle of chat? (like “Wheatley: normal i have unlocked in red Secret Phrase normal !”)

My script:
[lua]
local pattern = “[%[col=]+([%d]+[,]+[%d]+[,]+[%d]+)[%]]+(.+)” – Example: “[col=255,100,100]LOL”

hook.Add( “OnPlayerChat”, “ColorParseChat”, function( ply, text, Team, Dead )
local tab = {}

table.insert( tab, team.GetColor( ply ) )

if Dead then
    table.insert( tab, Color( 255, 30, 40 ) )
    table.insert( tab, "*DEAD* " )
end

if Team then
    table.insert( tab, Color( 30, 160, 40 ) )
    table.insert( tab, "(TEAM) " )
end

table.insert( tab, ( IsValid( ply ) ) and ply:GetName() or "Console" )
table.insert( tab, Color( 255, 255, 255 ) )
table.insert( tab, ": " )

local ClearText = string.gsub( text, pattern, "" )
table.insert( tab,  ClearText )

local col, ColText = text:match( pattern ) 

if col and ColText then
    local tbl = string.Explode( ",", col )
    table.insert( tab, Color( tbl[1], tbl[2], tbl[3] ) )
    table.insert( tab, ColText )
end

chat.AddText( unpack(tab) )

return true

end)
[/lua]

http://s43.radikal.ru/i099/1107/6d/64ff78b95dcc.jpg