Raised This Month: $51 Target: $400
 12% 

Colouring Chat


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nomarky
SourceMod Donor
Join Date: Sep 2007
Old 03-02-2009 , 08:24   Colouring Chat
Reply With Quote #1

I'm trying to change chat colour, by a defined admin flag. This works, bu the problem I'm having is I can only change the colour of the whole message, name included.

What I'm trying to achieve is keep the player's name in team colours, and only change the colour of the message the player typed. Putting the Team colour codebefore the player name don't seem to be working.

Anyone shed any light?
Nomarky is offline
MikeJS
Senior Member
Join Date: Nov 2008
Old 03-02-2009 , 11:17   Re: Colouring Chat
Reply With Quote #2

PHP Code:
SayText2(client, const String:message[]) {
    new 
Handle:buffer StartMessageAll("SayText2");
    if(
buffer!=INVALID_HANDLE) {
        
BfWriteByte(bufferclient);
        
BfWriteByte(buffertrue);
        
BfWriteString(buffermessage);
        
EndMessage();
    }
}
decl String:buffer[256];
Format(buffersizeof(buffer), "\x01white \x03team \x04green");
SayText2(clientbuffer); // If client is on the red team, the colour in chat will be red 
MikeJS is offline
Nomarky
SourceMod Donor
Join Date: Sep 2007
Old 03-02-2009 , 14:09   Re: Colouring Chat
Reply With Quote #3

Thanks. I've been playing with SayText2, but the problem I'm getting is that the player name shows up red in chat to the red team, but blue in chat to the blue team, regardless of what team (or spec) the player who is chatting is on.

Is it possible to lock the player name's colour in chat to the team the player is on? So if someone on the blue team types something, both blue and red players see the players name in chat coloured blue
Nomarky is offline
MikeJS
Senior Member
Join Date: Nov 2008
Old 03-02-2009 , 14:51   Re: Colouring Chat
Reply With Quote #4

Use the client parameter of SayText2 as the person speaking. ShowText2 prints to everyone.
MikeJS is offline
Nomarky
SourceMod Donor
Join Date: Sep 2007
Old 03-03-2009 , 11:37   Re: Colouring Chat
Reply With Quote #5

So SayText2 won't work for team (ie '(TEAM) Name : message') chat then?
Nomarky is offline
MikeJS
Senior Member
Join Date: Nov 2008
Old 03-03-2009 , 12:40   Re: Colouring Chat
Reply With Quote #6

PHP Code:
SayText2One(clientauthor, const String:message[]) {
    new 
Handle:buffer StartMessageOne("SayText2"client);
    if (
buffer != INVALID_HANDLE) {
        
BfWriteByte(bufferauthor);
        
BfWriteByte(buffertrue);
        
BfWriteString(buffermessage);
        
EndMessage();
    }

MikeJS 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 12:57.


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