[src] addition to whisper online/offline

Codes already submitted by people of the forums.
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

ok this is a very small thing i just did cause i cant get friend list to show online offline atm due to lack of time

so anyway adding a couple of lines to the whisper code in HG will allow you to see if someone is offline rarther than the .to command just ignoring you

Code: Select all

void CGame::ToggleWhisperPlayer(int iClientH, char * pMsg, DWORD dwMsgSize)
{
 char   seps[] = "= \t\n";
 char   * token, cName[11], cBuff[256];
 class  CStrTok * pStrTok;
 register int i;
 char *cp;
 WORD *wp;

	if (m_pClientList[iClientH] == NULL) return;
	if (dwMsgSize <= 0) return;

	ZeroMemory(cName, sizeof(cName));
	ZeroMemory(cBuff, sizeof(cBuff));
	memcpy(cBuff, pMsg, dwMsgSize);

	pStrTok = new class CStrTok(cBuff, seps);
	token = pStrTok->pGet();
	token = pStrTok->pGet();
    
	if (token == NULL) {
  m_pClientList[iClientH]->m_iWhisperPlayerIndex = -1;
  ZeroMemory(m_pClientList[iClientH]->m_cWhisperPlayerName, sizeof(m_pClientList[iClientH]->m_cWhisperPlayerName));
  m_pClientList[iClientH]->m_bIsCheckingWhisperPlayer = FALSE;
  // Whisper mode enabled
  SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_WHISPERMODEOFF, NULL, NULL, NULL, cName);
	}
	else {
  if (strlen(token) > 10)	
    memcpy(cName, token, 10);
  else memcpy(cName, token, strlen(token));
  
  m_pClientList[iClientH]->m_iWhisperPlayerIndex = -1;

  for (i = 1; i < DEF_MAXCLIENTS; i++) 
  	if ((m_pClientList[i] != NULL) && (memcmp(m_pClientList[i]->m_cCharName, cName, 10) == 0)) {
    if (i == iClientH) {
    	delete pStrTok;
    	// Whisper self XenX
    SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, "You shouldnt talk to yourself!");
    	return;
    }
    m_pClientList[iClientH]->m_iWhisperPlayerIndex = i;
    ZeroMemory(m_pClientList[iClientH]->m_cWhisperPlayerName, sizeof(m_pClientList[iClientH]->m_cWhisperPlayerName));
    strcpy(m_pClientList[iClientH]->m_cWhisperPlayerName, cName);
      	break;
  	}

  if (m_pClientList[iClientH]->m_iWhisperPlayerIndex == -1) {
  	ZeroMemory(cBuff, sizeof(cBuff));
  	cp = (char *)cBuff;
  	*cp = GSM_REQUEST_FINDCHARACTER;
  	cp++;

  	wp = (WORD *)cp;
  	*wp = m_wServerID_GSS;
  	cp += 2;

  	wp = (WORD *)cp;
  	*wp = iClientH;
  	cp += 2;

  	memcpy(cp, cName, 10);
  	cp += 10;

  	memcpy(cp, m_pClientList[iClientH]->m_cCharName, 10);
  	cp += 10;

  	bStockMsgToGateServer(cBuff, 25);

  	ZeroMemory(m_pClientList[iClientH]->m_cWhisperPlayerName, sizeof(m_pClientList[iClientH]->m_cWhisperPlayerName));
  	strcpy(m_pClientList[iClientH]->m_cWhisperPlayerName, cName);
  	m_pClientList[iClientH]->m_bIsCheckingWhisperPlayer = TRUE;
  }
  else{
  	SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_WHISPERMODEON, NULL, NULL, NULL, m_pClientList[iClientH]->m_cWhisperPlayerName);
return;
  }
  //player not online XenX
  SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, "This player is not online!");
	}
	delete pStrTok;
}
this displays "This player is not online" or " you shouldnt talk to yourself" for the 2 instances where the /to command does nothing at all.
Jehovah
noob
Posts: 19
Joined: Sat Sep 02, 2006 3:15 am

Post by Jehovah »

Image

Seem's to have a small bug, but is a good idea.
bone-you
Spamtastic
Posts: 1310
Joined: Wed Mar 16, 2005 3:12 am

Post by bone-you »

Won't work across hgs.


}
//player not online XenX
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, "This player is not online!");
}

there's no return before that in case it DOES work so that will -always- be sent.
<img src='http://www.helbreathx.net/sig/sig.jpeg' border='0' alt='user posted image' /><br><a href='http://mafia.cheats4us.org/index.php?x=231030' target='_blank'>#1 on Mafia :D</a><br><!--QuoteBegin-Slipknight+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Slipknight)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->100mb Internet, burstable too 10GB oc192<br>his speed can go up too 10gbs<br>...<br>Yes my car can have a top speed of 1000mph<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>^^ I wonder where the retard went to.
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

yes i just found that out, i didnt have anyone to whisper to test it, so i didnt notice that.

any idea of a fix ? just a return after successfull whisper?
Crossfade
Loyal fan
Posts: 354
Joined: Sun Mar 20, 2005 5:55 pm

Post by Crossfade »

xenx wrote: yes i just found that out, i didnt have anyone to whisper to test it, so i didnt notice that.

any idea of a fix ? just a return after successfull whisper?
it will stop it from saying your offline when your online because you have it closed but no return which means it will jump to the next part which is showing their offline if they're online. so adding a return will stop it after showing their online when it reads it and then when it hits the return it will do nothing else will show their offline
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

are you agreeing with me or telling me it wont work? hehe
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

it does work.. its only 1 small bug thats easily fixed.. jeez..
Crossfade
Loyal fan
Posts: 354
Joined: Sun Mar 20, 2005 5:55 pm

Post by Crossfade »

xenx wrote: are you agreeing with me or telling me it wont work? hehe
if you were referring to me i was trying to help you but if your referring to bone-you, looks like he was helping as in telling you what was wrong
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

i was referring to you :P i couldnt tell wether u were saying it wont work or it will hehe.

and yeh i got what bone-you was saying, iv done it im just waiting for final test b4 i update first post :)
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

ok original updated, that problem fixed, and i waited to test it this time, it works..
Jehovah
noob
Posts: 19
Joined: Sat Sep 02, 2006 3:15 am

Post by Jehovah »

Yeah , it work's. :rolleyes:

Also helpful
Firestorm
Loyal fan
Posts: 260
Joined: Fri Apr 07, 2006 10:29 pm

Post by Firestorm »

you guys can be happy that still people post codes for HB and the only shit you guys do is flamming than.....

Thanks xenx :) thats a nice add on for the whisper ^-^
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

thanks man, i know its only small but i only know C++ from looking at the helbreath sources.

and yeh, i like to fix the small things that make the game look more err ... finished? professional?

amazing how much difference to the gaming experience the small things can make.
I sat and went through EVERY SINGLE message on the client the day b4 yesrerday and corrected ALL the english.. no more half korean/half english on my client :D

that took AGES.. but it was worth it :D
Crossfade
Loyal fan
Posts: 354
Joined: Sun Mar 20, 2005 5:55 pm

Post by Crossfade »

xenx wrote: i was referring to you :P i couldnt tell wether u were saying it wont work or it will hehe.

and yeh i got what bone-you was saying, iv done it im just waiting for final test b4 i update first post :)
sorry i wrote that in a hurry and messy. i'll be more clear next time, i was trying to tell you how the return worked when you don't have one where it should be.
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

ya i got it cheers m8 :)
Post Reply