View Single Post
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 01-24-2011 , 20:01   Re: SMLIB 0.9 BETA (266 Function Stocks)
Reply With Quote #2

SMLib Colors API

The smlib colors API is a very powerful system for coloring the chat,
written to be as flexible as possible (alternative colors, color overriding) while keeping an
eye on performance. It should be almost as fast as Sourcemod's native PrintToChat. It also
uses some caching techniques which means smlib's Client_PrintToChatAll() can be even faster than sourcemod's native.

Here are the color tags you can use with Color_ParseChatText() and all Client_PrintToChat() functions.

This table shows the default/hardcoded into smlib settings, but they
can be overriden by placing a smlib_colors.games.txt into the gamedata folder.



Legend:
² Colors only available in Teamplay Mode (mp_teamplay 1)
³ The game automatically colors player nicknames into their team colors.


Things you should know...

  • Only one team/subject color can be used in one message, this doesn't mean you can color only one phrase, that means you can only use red or blue or green in one print.
  • The team specific subject colors (eg.: red, blue) are only used if at least one client is in that team that has the color, if not, the alternative color is used.
  • the {RB} and {BR} tags use either Red or Blue for coloring, depending on if a team has clients in it, if all teams are empty, green is used by default.
  • Colors that are unavailable are replaced with green by default.
Overriding the default color settings

File: gamedata/smlib_colors.games.txt

The color settings can be overriden with a gamedata file, while this shouldn't be necessary
for games like TF2, CS:S, HL2:DM, L4D(2), DOD:S, this can be very useful for older games or
upcoming games like Portal 2.

There comes a gamedata file with smlib that has the default settings for the games mentioned above,
if SayText2 isn't supported, smlib automatically disables team/subject colors itself.
Note that you don't have to distribute this file for colors to work in most cases.

Valid colors are:

"normal"
"orange"
"red"
"redblue"
"blue"
"bluered"
"team"
"lightgreen"
"gray"
"green"
"olivegreen"
"black"

Valid keyvalues are:

color_code Color Code (1 - 8)
color_alternative Defines the index of alternative color (see the chatColorInfo array in colors.inc)
color_supported Set to "true" if the color is supported, "false" otherwise.
color_subjecttype (see ChatColorSubjectType enum in colors.inc, any value higher than 0 defines a team color)
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0

Last edited by berni; 09-30-2012 at 17:13.
berni is offline