Raised This Month: $ Target: $400
 0% 

Colors in message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pTu
Senior Member
Join Date: Nov 2010
Location: Poland
Old 05-19-2012 , 20:32   Colors in message
Reply With Quote #1

Hello

I need use other colors than

Quote:
PrintToChatAll ("\x01 1 .. \x02 2 .. \x03 3 .. \x04 4 .. \x05 5 .. \x06 6 .. \x07 7 .. \x08 8");
How I can add to my message colors, example:
Code:
#000000
#CCCCCC
etc.
Game: TF2
pTu is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 05-19-2012 , 20:38   Re: Colors in message
Reply With Quote #2

Taken from one of my other posts, given the message, sText, use the code below along with colors in the format {#FFFFFF} for RGB or {#FFFFFFFF} for RGBA etc.

PHP Code:
new iStartiEndiTotal;
decl String:sHex[9], String:sCodeBefore[12], String:sCodeAfter[10];
while ((
iStart StrContains(sText[(iTotal)], "{#")) != -1) {
    if ((
iEnd StrContains(sText[iTotal+iStart+2], "}")) != -1) {
        if (
iEnd == || iEnd == 8) {
            
strcopy(sHexiEnd+1sText[iTotal+iStart+2]);
            
Format(sCodeBeforesizeof(sCodeBefore), "{#%s}"sHex);
            
Format(sCodeAftersizeof(sCodeAfter), (iEnd == "\x07%s" "\x08%s"), sHex);
            
ReplaceString(sTextsizeof(sText), sCodeBeforesCodeAfter);
            
iTotal += iStart iEnd 1;
        }
        else {
            
iTotal += iStart iEnd 3;
        }
    }
    else {
        break;
    }

__________________

Last edited by 11530; 05-19-2012 at 20:41.
11530 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-19-2012 , 21:24   Re: Colors in message
Reply With Quote #3

Quote:
Originally Posted by pTu View Post
Hello

I need use other colors than



How I can add to my message colors, example:
Code:
#000000
#CCCCCC
etc.
Game: TF2
Have you tried
PHP Code:
PrintToChatAll("\x07000000The first color \x07CCCCCCThe second color"); 
as noted in the Plugins can now use custom colors in chat messages in TF2 thread?
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 05-19-2012 at 21:27.
Powerlord is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 05-19-2012 , 22:16   Re: Colors in message
Reply With Quote #4

Hah I didn't think that he might just want hard-coded values. Naturally I just assumed the harder route of user-defined ones.
__________________
11530 is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 05-19-2012 , 22:36   Re: Colors in message
Reply With Quote #5

Hardcored color vals. have an error atm showing the HEX value before the message in player consoles. So... in that case I'd stay with 11530's way.

Last edited by ReFlexPoison; 05-19-2012 at 22:36.
ReFlexPoison is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 05-19-2012 , 23:06   Re: Colors in message
Reply With Quote #6

Quote:
Originally Posted by ReFlexPoison View Post
Hardcored color vals. have an error atm showing the HEX value before the message in player consoles. So... in that case I'd stay with 11530's way.
Not for me....
__________________
Dr. McKay is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 05-20-2012 , 00:00   Re: Colors in message
Reply With Quote #7

Quote:
Originally Posted by Dr. McKay View Post
Not for me....
Really, cause for me, in console, anything message hardcored HEX value for the color shows as #XXXXXXMy Message in console.

I raised it before in a previous thread:

Quote:
Originally Posted by Dr. McKay View Post
That's a good point. Someone mention it to Valve and they ought to fix it "soon".
ReFlexPoison is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 05-20-2012 , 00:15   Re: Colors in message
Reply With Quote #8

Quote:
Originally Posted by ReFlexPoison View Post
Really, cause for me, in console, anything message hardcored HEX value for the color shows as #XXXXXXMy Message in console.

I raised it before in a previous thread:
I replied to that before I went in-game and tried it. Whenever I'm rainbowized and chat, it shows up fine in the console.
__________________
Dr. McKay is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 05-20-2012 , 01:49   Re: Colors in message
Reply With Quote #9

Quote:
Originally Posted by Dr. McKay View Post
I replied to that before I went in-game and tried it. Whenever I'm rainbowized and chat, it shows up fine in the console.
hmm, dont know then
ReFlexPoison is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode