View Single Post
CoolJosh3k
AlliedModders Donor
Join Date: Mar 2010
Old 01-12-2020 , 07:15   Re: [ANY] Basic Donator Interface
Reply With Quote #269

A TF2 community I play with wondered if I could fix it so it had any colour. I did just that.

Modify the code as desired to add the colours you want, then compile it.

Note that you will need morecolors.inc instead of colors.inc

Colour codes are in hex format RGB.

If for example you wanted to add a gold colour then you can update it to this:

PHP Code:
enum
{
    
cNone 0,
    
cRed,
    
cGreen,
    
cBlue,
    
cMagenta,
    
cCyan,
    
cYellow,
    
cBlack,
    
cGrey,
    
cHotPink,
    
cCrayolaGold,
    
cRandom,
    
cMax
};


new 
String:szColorCodes[][] = {
    
"\x01"// Default
    
"\x07FF0000" ,    //Red
    
"\x0700FF00" ,    //Green
    
"\x070000FF" ,    //Blue
    
"\x07FF00FF" ,    //Magenta
    
"\x0700FFFF" ,    //Cyan
    
"\x07FFFF00" ,    //Yellow
    
"\x07000000" ,    //Black
    
"\x07CCCCCC" ,    //Grey
    
"\x07E6BE8A" ,    //Crayola Gold
    
"\x07FF69B4"    //Hot Pink
    
};

new const 
String:szColorNames[cMax][] = {
    
"None",
    
"Red",
    
"Green",
    
"Blue",
    
"Magenta",
    
"Cyan",
    
"Yellow",
    
"Black",
    
"Grey",
    
"Hot Pink",
    
"Crayola Gold",
    
"Random"
}; 
The \x07 indicates you are going to supply an RGB colour in hex. The next 6 characters are the RGB hex code for which colour you want to show in game. You can find a few tools on the web that will help you find the RGB hex code for the colour you desire.

As a bonus: if you want transparent text you can use \x08 instead and supply another 2 character on the end for the alpha value. For example \x08000000BF (black) where BF is the alpha value for 75% opacity.
Attached Files
File Type: sp Get Plugin or Get Source (donator.colorchat.sp - 80 views - 4.6 KB)
CoolJosh3k is offline