[Src]ShowClientMsg Addon

Codes already submitted by people of the forums.
Post Reply
Acidx
Member
Posts: 198
Joined: Tue Mar 23, 2004 4:27 am

Post by Acidx »

Hey guys Just here to post a little addon to KLKS's ShowClientMsg Function its a really simple function he made here but he missed out on an addition that i have made.. he didnt make it so you can choose by command line wich ChatType you wanna use So its stuck on 1 chat type the green font at the bottem WELL i played around with it a bit and i was like well it would be cool to have a multi-chattype in this function so i made it...

Ok First off Lets get to Changing the code

find the function in game.cpp
void CGame::ShowClientMsg(

replace the full function with this or make a complete new one its up to you but if you do rename it if your not a copy+paster and know at least 1 step of C++...

Code: Select all

//Original Code by KLKS
//Updated by Acidx
void CGame::ShowClientMsg(int iClientH, char* pMsg, int iChatType)
{
	char * cp, cTemp[256];
	DWORD * dwp, dwMsgSize;
	WORD * wp;
	short * sp;

	ZeroMemory(cTemp, sizeof(cTemp));

	dwp = (DWORD *)cTemp;
	*dwp = MSGID_COMMAND_CHATMSG;

	wp  = (WORD *)(cTemp + DEF_INDEX2_MSGTYPE);
	*wp = NULL;

	cp  = (char *)(cTemp + DEF_INDEX2_MSGTYPE + 2);
	sp  = (short *)cp;
	*sp = NULL;
	cp += 2;

	sp  = (short *)cp;
	*sp = NULL;
	cp += 2;

	memcpy(cp, "Server", 6); // Player name :P
	cp += 10;

	*cp = iChatType; // chat type
	cp++;

	dwMsgSize = strlen(pMsg);
	if(dwMsgSize > 50) dwMsgSize = 50;
	memcpy(cp, pMsg, dwMsgSize);
	cp += dwMsgSize;

	m_pClientList[iClientH]->m_pXSock->iSendMsg(cTemp, dwMsgSize + 22);
}
Now in Game.H find the define
void ShowClientMsg(
replace with

Code: Select all

void ShowClientMsg(int iClientH, char* pMsg, int iChatType);

Now If you just replaced the command find everything calling the function ShowClientMsg(
and add your ChatType to the end such as
ShowClientMsg(iClientH,"Text", 1);
Now this saying Show the client the message Text with chat type 1
Now im sure alot of ppl dont know what Chat type is wich so i took the libraty of Listing them

Code: Select all

Full chat types
1  = @ Guild Chat - GREEN TOP
2  = ! Global Chat - RED TOP
3  = ~ Town Chat - Blue TOP
4  = $ Party Chat - Goldish TOP
10 = GM CHAT - GREEN Bottem
so if you want to use Global change
ShowClientMsg(iClientH,"Text",1);
to
ShowClientMsg(iClientH,"Text",2);
and so on

Hope this helps you guys out ;)
Thanks to KLKS for the original code
<b>-<span style='color:green'>ACiD-x </span><span style='color:red'> Owning PCs Since 1987</span><br><img src='http://img204.imageshack.us/img204/2245/hackertf5.gif' border='0' alt='user posted image' /><br><img src='http://img509.imageshack.us/img509/6697 ... 4sc4ed.png' border='0' alt='user posted image' /><br><span style='color:orange'>i am Pwn NetGAYLORDS !</span></b><br><span style='color:blue'><br>I Pwn HBUSA =)</span>
Drajwer
&lt;3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

Code: Select all

1  = @ Guild Chat - GREEN TOP
2  = ! Global Chat - RED TOP
3  = ~ Town Chat - Blue TOP
4  = $ Party Chat - Goldish TOP
10 = GM CHAT - GREEN Bottem
im sure its not all. check in client
<img src='http://img440.imageshack.us/img440/2627/15pt.jpg' border='0' alt='user posted image' /><br><br>HBPolska characters:<br><br>Hellios 150+ Aresden Hero Mage<br>TheBill 120 Aresden plrider<br>Kill_Me 100 Full-Hero plrider<br>Rockeater 110+ Aresden Plate Mage<br><br><a href='http://www.helbreath.org' target='_blank'>http://www.helbreath.org</a> come and play (250 ppl online)
ADDKiD
&lt;3 bd long time
Posts: 967
Joined: Tue Jul 12, 2005 8:07 pm
Location: Washington, USA
Contact:

Post by ADDKiD »

Hmm.. Sounds good, Its possible to add another chatline right? Like use # for another form of chat. Or possibly to Store Character name's you've whispered..
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Useful...thx
QUOTE (ADDKiD @ Dec 1 2006, 4:01 PM) <br>You guys make me laugh alot, half the shit I say, is bullshit...<br><br><img src='http://img485.imageshack.us/img485/492/banssig1ng.gif' border='0' alt='user posted image' /><br><br><b>I see no changes at all, wake up in the morning and ask myself...<br>Is life worth living? Should I blast myself?</b><br><br><b><a href='http://2paclegacy.com' target='_blank'>2PacLegacy.com</a></b>
Post Reply