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

No Coloured Playernames since update


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Roger Devil
Senior Member
Join Date: Dec 2004
Location: Germany
Old 03-16-2007 , 04:52   No Coloured Playernames since update
Reply With Quote #1

Hi folks,
since the last update from 14.03.2007 they must have changed the way to display playernames in the team-colour for chat-messages.
Code:
	bf_write *pWrite;
	pWrite = engine->UserMessageBegin((IRecipientFilter *)&filter,3);
	pWrite->WriteByte(nId); // nId is the id of the player
	pWrite->WriteString("Player xxxx is camping);
	pWrite->WriteByte(1);
	engine->MessageEnd();
Does anyone have an solution ???
Roger Devil is offline
Send a message via ICQ to Roger Devil
BeetleFart
SourceMod Donor
Join Date: Apr 2004
Old 03-16-2007 , 05:48   Re: No Coloured Playernames since update
Reply With Quote #2

Quote:
Originally Posted by Roger Devil View Post
Hi folks,
since the last update from 14.03.2007 they must have changed the way to display playernames in the team-colour for chat-messages.
Code:
	bf_write *pWrite;
	pWrite = engine->UserMessageBegin((IRecipientFilter *)&filter,3);
	pWrite->WriteByte(nId); // nId is the id of the player
	pWrite->WriteString("Player xxxx is camping);
	pWrite->WriteByte(1);
	engine->MessageEnd();
Does anyone have an solution ???

i added pWrite->WriteByte(0x02); before the text string
and added pWrite->WriteByte(0x01);
after the text string and its working for me
__________________
CSource Server:
69.90.34.10:27015 Beetlesmod.com And CS-Addicts{US}



http://www.clanuseast.com
BeetleFart is offline
Roger Devil
Senior Member
Join Date: Dec 2004
Location: Germany
Old 03-16-2007 , 09:11   Re: No Coloured Playernames since update
Reply With Quote #3

Thx a lot, it works
Roger Devil is offline
Send a message via ICQ to Roger Devil
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 05-19-2007 , 10:16   Re: No Coloured Playernames since update
Reply With Quote #4

Quote:
Originally Posted by BeetleFart View Post
i added pWrite->WriteByte(0x02); before the text string
and added pWrite->WriteByte(0x01);
after the text string and its working for me
So..

Code:
	bf_write *pWrite;
	pWrite = engine->UserMessageBegin((IRecipientFilter *)&filter,3);
	pWrite->WriteByte(0x02); 
	pWrite->WriteString("Player xxxx is camping);
        pWrite->WriteByte(0x01);
	pWrite->WriteByte(1);
	engine->MessageEnd();
OR

Code:
	bf_write *pWrite;
	pWrite = engine->UserMessageBegin((IRecipientFilter *)&filter,3);
	pWrite->WriteByte(nId); // nId is the id of the player
	pWrite->WriteByte(0x02); 
	pWrite->WriteString("Player xxxx is camping);
        pWrite->WriteByte(0x01);
	engine->MessageEnd();
OR

Code:
	bf_write *pWrite;
	pWrite = engine->UserMessageBegin((IRecipientFilter *)&filter,3);
	pWrite->WriteByte(nId); // nId is the id of the player
	pWrite->WriteByte(0x02); 
	pWrite->WriteString("Player xxxx is camping);
        pWrite->WriteByte(0x01);
        pWrite->WriteByte(1);
	engine->MessageEnd();
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
Saul
Junior Member
Join Date: Jun 2007
Old 06-23-2007 , 06:58   Re: No Coloured Playernames since update
Reply With Quote #5

This works:
Code:
        // Color of player index
        pWrite->WriteByte( PlayerIndex );    // For global message: 0
        pWrite->WriteByte(0x02);

        // Add the message
        pWrite->WriteString( Message );        // Add the message

        // Add color byte
        pWrite->WriteByte(0x01);
        pWrite->WriteByte(0);

        // Send the message
        engine->MessageEnd();
Saul is offline
Send a message via MSN to Saul
Nicolous
Junior Member
Join Date: May 2005
Location: Reims (France)
Old 08-27-2007 , 08:49   Re: No Coloured Playernames since update
Reply With Quote #6

This method does not make possible to place other colors than the colour of the team in the message.
I found an other method which make possible to place multi-colours in the message :

Code:
// void sayMsg(char * mess, int playerIndex = 0);
void sayMsg(char * mess, int playerIndex)
{
	MRecipientFilter filter; 
	filter.AddAllPlayers();
	bf_write * pBitBuf = engine->UserMessageBegin( &filter, SAYTEXT ); // SAYTEXT == 3
	pBitBuf->WriteByte(playerIndex); // playerIndex is the index of the player whose name is quoted in the message
	pBitBuf->WriteString(mess);
	pBitBuf->WriteByte(1);  // or 0, I don't know the difference
	engine->MessageEnd();
}
Example :
Code:
char buf[64];
Q_snprintf(buf,sizeof(buf),"\004Player \003%s\001 is dead\n",player->GetName());
sayMsg(buf,engine->IndexOfEdict(pEntity));
can display :
Quote:
Player Nicolous is dead
if Nicolous is CT
When "indexPlayer" is 0, the text is lightgreen.

If I use this function :
Code:
void sayMsg(const char * mess) // No index provided
{
	MRecipientFilter filter; 
	filter.AddAllPlayers();
	bf_write * pBitBuf = engine->UserMessageBegin( &filter, MESSAGE_SAYTEXT );
	// pBitBuf->WriteByte(index); // NO index provided
	pBitBuf->WriteByte(0x02);
	pBitBuf->WriteString(buf);
	pBitBuf->WriteByte(0x01);
	pBitBuf->WriteByte(1);
	engine->MessageEnd();
}
when I write
Code:
sayMsg("This text is \003red or blue\001\n");
the text "red or blue" is randomly red or blue. However "red or blue” is not the name of a player
__________________

Last edited by Nicolous; 08-27-2007 at 10:03.
Nicolous is offline
Saul
Junior Member
Join Date: Jun 2007
Old 09-17-2007 , 11:19   Re: No Coloured Playernames since update
Reply With Quote #7

Maybe its thinking 0x02 (which as an integer is 2) is the index. And probably the first person on CT or T will be index 2?
Saul is offline
Send a message via MSN to Saul
Nicolous
Junior Member
Join Date: May 2005
Location: Reims (France)
Old 09-17-2007 , 11:34   Re: No Coloured Playernames since update
Reply With Quote #8

Well, in reality on a dedicated server the color is always white, not randomly red or blue

On my listen server when I'm CT the message appears red, and it appears blue when I'm T It's not fully logic
__________________
Nicolous is offline
Fredd
Veteran Member
Join Date: Jul 2007
Old 03-16-2008 , 02:26   Re: No Coloured Playernames since update
Reply With Quote #9

Nicolous: i been trying to use your second way but it doesnt seem to work with SayText or SayText2...i just get all orange text
__________________
Need a private coder? AMXX, SourceMOD, MMS? PM me!
Fredd 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 04:30.


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