General > Developers Corner
Chat Colors?
Jaden Zepeda:
I know some servers where they can type [color]Text and the text in chat is that color, how do they do this? They can even type [rainbow]Text and its flashing rainbows.
JamminR:
PlayerSay is your friend (and can be a pain, as you can break ALL OTHER CHAT based mods if not done correctly)
You'll also need to use a substring and find in text to look for the "[" and ending "]" in the beginning, then read the word in-between them.
As for how to do the output text in color, I forget exactly, but I'd look over the releases section for the Player Chat Tags release. It will show you basic methods for just about all of your needs of color and chat output.
We'd much rather you learn on your own pace than give you direct code.
Keep it simple.
A recommendation - Don't go full functions inside of hooks or functions like you did on the last SteamGroup challenge.
Where you did
hook.add (blah, blah, function ()
....
end) , though perfectly 'legal' in lua, can make it more complex to understand when trying to troubleshoot/read it later.
I'd recommend using hook.Add ( blah, blah, function_name ) below the actual function.
Easier readability. Easier to learn I think, can see where variables are being passed to function easier.
Just my .02. Some devs are likely to disagree.
Jaden Zepeda:
Alright ill give it a shot.
XxLMM13xX:
I would send you to the link on coderhire because its called HatsChat2 and its awesome i would put the file in but i think that illegal i don't know...
Jaden Zepeda:
Exactly what I was looking for, thanks.
Navigation
[0] Message Index
[#] Next page
Go to full version