[src] Ek Announcer

Codes already submitted by people of the forums.
Dax
<3 bd long time
Posts: 785
Joined: Mon Apr 18, 2005 3:19 pm

Post by Dax »

This is in another topic somewhere but this is the right section. Add this in the backend of CGame::ClientKilledHandler. Preferably before the return :P

Code: Select all

//----------------------------EK Announcer-------------------------
//---- Function: CGame::ClientKilledHandler
//---- Description: Announces a message to alert all connected 
//---- clients an EK has taken place                          
//---- Version: HBX 2.03 Build                                
//---- Date: November 07 2005                                 
//---- By: Daxation                                                          
//-----------------------------------------------------------------
char cEKMsg[1000];
ZeroMemory(cEKMsg, sizeof(cEKMsg));
// Multiple EK Messages
// Note - Remove section '01' and replace with alternative code for a single message
// Alternative code: wsprintf(cEKMsg, "%s killed %s", cAttackerName, m_pClientList[iClientH]->m_cCharName);
// 01
switch (iDice(1,3)) 
// You can add extra messages by creating a new case.
// Remember to increase iDice
{
case 1: // To reverse the order the names appear in the message reverse the last 2 parameters
	wsprintf(cEKMsg, "%s killed %s message 1", cAttackerName, m_pClientList[iClientH]->m_cCharName);
 break;
case 2:
	wsprintf(cEKMsg, "%s killed %s message 2", cAttackerName, m_pClientList[iClientH]->m_cCharName);
 break;
case 3:
	wsprintf(cEKMsg, "%s killed %s message 2", cAttackerName, m_pClientList[iClientH]->m_cCharName);
 break;
default:
	wsprintf(cEKMsg, "%s killed %s message 3", cAttackerName, m_pClientList[iClientH]->m_cCharName);
 break;
}
// 01
for (i = 1; i < DEF_MAXCLIENTS; i++) // Check all clients
{
	if ((m_pClientList[i] != NULL))  // Check if client is avtice
	{
  SendNotifyMsg(NULL, i, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, cEKMsg); // Send message to client
  // Log EK
  wsprintf(G_cTxt, "%s killed %s", cAttackerName, m_pClientList[iClientH]->m_cCharName); // Log message
  PutLogFileList(G_cTxt); // Enter into logs
	}
}
//-----------------------------------------------------------------
//----                   End EK Announcer Code                 ----
//-----------------------------------------------------------------
[EDIT]
Heres the 2 line version which is spoken of further down the topic.
wsprintf(G_cTxt, "%s killed %s", cAttackerName, m_pClientList[iClientH]->m_cCharName);
for (i = 1; i < DEF_MAXCLIENTS; i++) if (m_pClientList != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_NOTICEMSG,    NULL, NULL, NULL, G_cTxt);

This 1 goes in the same place.
Reppin' 127.0.0.1!!!<br><br><img src='http://img502.imageshack.us/img502/1348/sig4daxbn2.jpg' border='0' alt='user posted image' /><br><br>I contend that we are both atheists. I just believe in one fewer god than you do. <br>When you understand why you dismiss all the other possible gods, you will <br>understand why I dismiss yours.<br>~ <b>Stephen Roberts</b>
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Thanks Dax!
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>
snoopy81
Loyal fan
Posts: 338
Joined: Mon Jul 12, 2004 7:13 pm

Post by snoopy81 »

So, I'll put in version, it's to be included in ::ClientKilledHandler(..)
Not it won't tell everybody on the server, but just to victim...

NB: "m_cKillerIndicator" is a global variable that must be set to:
0: Don't use the killer indicator
1: Use it, but hide Attaquer name during crusade.
2: Use it even during crusade.

NB: "DEF_OWNERTYPE_PLAYER_INDIRECT" was added to the server to identify the responsible for a lasting spell such as CloudKill.

Code: Select all

	ZeroMemory(cAttackerName, sizeof(cAttackerName));
	ZeroMemory(cKillerMsg, sizeof(cKillerMsg));  
	switch (cAttackerType) {
	case DEF_OWNERTYPE_PLAYER_INDIRECT: // 3
  if (m_pClientList[iAttackerH] != NULL)
  {	memcpy(cAttackerName, m_pClientList[iAttackerH]->m_cCharName, 10);   
   if ((m_bIsCrusadeMode == FALSE) && (m_cKillerIndicator >  0))
   {	wsprintf(cKillerMsg, "A spell from %s finished you!", m_pClientList[iAttackerH]->m_cCharName);
    ShowClientMsg(iClientH,  "Killed",cKillerMsg);
   }else if ((m_bIsCrusadeMode == TRUE)  && (m_cKillerIndicator == 2))
   {	wsprintf(cKillerMsg, "A spell from (%d) finished you!", iAttackerH);
    ShowClientMsg(iClientH,  "Killed",cKillerMsg);
  }	}
  break;
	case DEF_OWNERTYPE_PLAYER:
  if (m_pClientList[iAttackerH] != NULL)
  {	memcpy(cAttackerName, m_pClientList[iAttackerH]->m_cCharName, 10);  
   if ((m_bIsCrusadeMode == FALSE) && (m_cKillerIndicator >  0))	
   {	wsprintf(cKillerMsg, "You have been annihilated by %s.", m_pClientList[iAttackerH]->m_cCharName);
    ShowClientMsg(iClientH,  "Killed",cKillerMsg);
   }else if ((m_bIsCrusadeMode == TRUE)  && (m_cKillerIndicator == 2))	
   {	wsprintf(cKillerMsg, "You have been annihilated by (%d).", iAttackerH);
    ShowClientMsg(iClientH,  "Killed",cKillerMsg);
  }	}	
  break;
	case DEF_OWNERTYPE_NPC:
  if (m_pNpcList[iAttackerH] != NULL)
  {	memcpy(cAttackerName, m_pNpcList[iAttackerH]->m_cNpcName, 20);	
   if (   ((m_bIsCrusadeMode == FALSE) && (m_cKillerIndicator >  0))
    || ((m_bIsCrusadeMode == TRUE)  && (m_cKillerIndicator == 2)))
   {	wsprintf(cKillerMsg, "You have been slaughtered by %s.", m_pNpcList[iAttackerH]->m_cNpcName);
    ShowClientMsg(iClientH,  "Killed",cKillerMsg);
  }	}	
  break;
	default:
  break;
	}
	SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_KILLED, NULL, NULL, NULL, cAttackerName); 
_\_ _<br> / , \__/ . \ Admin of Equilibrium Project<br> II\ \___ . O<br> III \_/ \ _ / <a href='http://www.equiprojet.com' target='_blank'>http://www.equiprojet.com</a><br> II I¯I
Slipknight
Loyal fan
Posts: 423
Joined: Thu Apr 07, 2005 7:53 pm

Post by Slipknight »

Good job copy and pasting myne ^^
<img src='http://www.bleachportal.net/interactive ... irjjkt.jpg' border='0' alt='user posted image' /><br><img src='http://www.hazegfx.com/UserBanners/Slipknot%20Fan.jpg' border='0' alt='user posted image' /><br><img src='http://www.hazegfx.com/UserBanners/UT2004%20Player.jpg' border='0' alt='user posted image' /><br><img src='http://www.hazegfx.com/UserBanners/AC%20DC%20Fan.png' border='0' alt='user posted image' /><br>
diuuude
Outpost bitch
Posts: 592
Joined: Wed Dec 28, 2005 11:57 pm

Post by diuuude »

Yours ???

Wasn't it coded by XTra KrazzY ? :unsure:
<a href='http://www.technohell.net' target='_blank'><b><span style='color:red'>>>> Helbreath Ressources Website Here <<<</span></b></a><br>C++ Sources, Tools, Server Files, Help on Forum, C++ Snippets, Toplist... Updated often, come visit us !
ADDKiD
&lt;3 bd long time
Posts: 967
Joined: Tue Jul 12, 2005 8:07 pm
Location: Washington, USA
Contact:

Post by ADDKiD »

I believe so...
Dax
&lt;3 bd long time
Posts: 785
Joined: Mon Apr 18, 2005 3:19 pm

Post by Dax »

Slipknight wrote: Good job copy and pasting myne ^^
Yours? Krazys? Are you talking about my EK Announcer? Because I believe they are both bugged. I did this ground up anyway it's a peice of shit excuse for code, it could be about 2 lines if you wanted so have the credit I don't need it.
Reppin' 127.0.0.1!!!<br><br><img src='http://img502.imageshack.us/img502/1348/sig4daxbn2.jpg' border='0' alt='user posted image' /><br><br>I contend that we are both atheists. I just believe in one fewer god than you do. <br>When you understand why you dismiss all the other possible gods, you will <br>understand why I dismiss yours.<br>~ <b>Stephen Roberts</b>
Cleroth
Loyal fan
Posts: 416
Joined: Wed Jun 16, 2004 7:08 pm

Post by Cleroth »

Looks like the one Ice-T made in HBU ? Or it's just me?
<img src='http://ic1.deviantart.com/fs11/i/2006/1 ... leroth.gif' border='0' alt='user posted image' />
Dax
&lt;3 bd long time
Posts: 785
Joined: Mon Apr 18, 2005 3:19 pm

Post by Dax »

Cleroth wrote: Looks like the one Ice-T made in HBU ? Or it's just me?
Ice's pwns mine. His had an external file for the messages also.
Reppin' 127.0.0.1!!!<br><br><img src='http://img502.imageshack.us/img502/1348/sig4daxbn2.jpg' border='0' alt='user posted image' /><br><br>I contend that we are both atheists. I just believe in one fewer god than you do. <br>When you understand why you dismiss all the other possible gods, you will <br>understand why I dismiss yours.<br>~ <b>Stephen Roberts</b>
sokol
Loyal fan
Posts: 228
Joined: Mon May 02, 2005 7:28 pm
Location: P(r)oland

Post by sokol »

Mhmm i have 2 errors on it:

Code: Select all

void CGame::ClientKilledHandler(int iClientH, int iAttackerH, char cAttackerType, short sDamage)
//----------------------------EK Announcer-------------------------
char cEKMsg[1000];
ZeroMemory(cAttackerName, sizeof(cAttackerName));
ZeroMemory(cKillerMsg, sizeof(cKillerMsg)); 
switch (cAttackerType) {
case DEF_OWNERTYPE_PLAYER_INDIRECT: // 3
  if (m_pClientList[iAttackerH] != NULL)
  { memcpy(cAttackerName, m_pClientList[iAttackerH]->m_cCharName, 10);   
   if ((m_bIsCrusadeMode == FALSE) && (m_cKillerIndicator >  0))
   { wsprintf(cKillerMsg, "A spell from %s finished you!", m_pClientList[iAttackerH]->m_cCharName);
    ShowClientMsg(iClientH,  "Killed",cKillerMsg);
   }else if ((m_bIsCrusadeMode == TRUE)  && (m_cKillerIndicator == 2))
   { wsprintf(cKillerMsg, "A spell from (%d) finished you!", iAttackerH);
    ShowClientMsg(iClientH,  "Killed",cKillerMsg);
  } }
  break;
case DEF_OWNERTYPE_PLAYER:
  if (m_pClientList[iAttackerH] != NULL)
  { memcpy(cAttackerName, m_pClientList[iAttackerH]->m_cCharName, 10); 
   if ((m_bIsCrusadeMode == FALSE) && (m_cKillerIndicator >  0))
   { wsprintf(cKillerMsg, "You have been annihilated by %s.", m_pClientList[iAttackerH]->m_cCharName);
    ShowClientMsg(iClientH,  "Killed",cKillerMsg);
   }else if ((m_bIsCrusadeMode == TRUE)  && (m_cKillerIndicator == 2))
   { wsprintf(cKillerMsg, "You have been annihilated by (%d).", iAttackerH);
    ShowClientMsg(iClientH,  "Killed",cKillerMsg);
  } }
  break;
case DEF_OWNERTYPE_NPC:
  if (m_pNpcList[iAttackerH] != NULL)
  { memcpy(cAttackerName, m_pNpcList[iAttackerH]->m_cNpcName, 20);
   if (   ((m_bIsCrusadeMode == FALSE) && (m_cKillerIndicator >  0))
    || ((m_bIsCrusadeMode == TRUE)  && (m_cKillerIndicator == 2)))
   { wsprintf(cKillerMsg, "You have been slaughtered by %s.", m_pNpcList[iAttackerH]->m_cNpcName);
    ShowClientMsg(iClientH,  "Killed",cKillerMsg);
  } }
  break;
default:
  break;
}
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_KILLED, NULL, NULL, NULL, cAttackerName); 
}
//----                   End EK Announcer Code                 ----

Someone can look on it and find something?
Tafka12
&lt;3 bd long time
Posts: 772
Joined: Wed Dec 28, 2005 6:32 pm

Post by Tafka12 »

You deleted whole other paart? let the other part be just ADD it not REPLACE it. put it in the end before last return; or smth. you can't delete other part.
<img src='http://www.hot.ee/carvanho/taavi.png' border='0' alt='user posted image' /><br><br><img src='http://www.hot.ee/carvanho/Elvine.png' border='0' alt='user posted image' /><br><img src='http://www.hot.ee/carvanho/LieroX.png' border='0' alt='user posted image' /><br><img src='http://www.hot.ee/carvanho/Football.png' border='0' alt='user posted image' />
popic
Member
Posts: 155
Joined: Wed Aug 18, 2004 10:08 am

Post by popic »

Slipknight wrote: Good job copy and pasting myne ^^
wow what a dumb prick, this ek announcer was coded by XtraKrazzy.
Shetar
Member
Posts: 148
Joined: Sun Nov 30, 2003 12:57 am

Post by Shetar »

Dump this code and rewrite it. This time, work as efficient as possible and make it flexible (for others slash noobs) to use it.
Helbreath II Project Manager & All round Developer. <br><i>(Don't worry, we're not dead)</i>
Drajwer
&lt;3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

will do :huh: :huh: :huh:
<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)
Dax
&lt;3 bd long time
Posts: 785
Joined: Mon Apr 18, 2005 3:19 pm

Post by Dax »

popic wrote:
Slipknight wrote: Good job copy and pasting myne ^^
wow what a dumb prick, this ek announcer was coded by XtraKrazzy.
Ffs.. This is the last time i'm going to say this.. Xtra and whoever the fuck else had ek announcers at the time both had bugs! That is why this was written. Locobans asked me to fix xtra's and when i saw it all i did was highlight it and hit delete. I coded this ground up and it could be almost 2 lines if you wanted. There lies another point. It could be 2 lines for a reason. The code to make it is pretty fucking standard.

The minimum required to make an ek announcer:
2 parts Sequence (Set the message and display the message)
1 part Selection (Check if the receiving client is active)
1 part Repetition (Get all the clients currently on the server)

1000 people could code this and 999 of them would probably code the exact same fucking thing. And the 1 who didn't end up with the same thing was probably spanish..

Next fucking retard to start this bullshit will get bitch slapped.

[EDIT]
Shetar wrote: Dump this code and rewrite it. This time, work as efficient as possible and make it flexible (for others slash noobs) to use it.
Heres your rewrite..

Code: Select all

wsprintf(G_cTxt, "%s killed %s", cAttackerName, m_pClientList[iClientH]->m_cCharName);
for(i=1;i<DEF_MAXCLIENTS;i++) if(m_pClientList[i]!=NULL) SendNotifyMsg(NULL,i,DEF_NOTIFY_NOTICEMSG,NULL,NULL,NULL,G_cTxt);
None of you probably thought it was possible when i said this before.. 2 line ek announcer.

Put that in the end of CGame::ClientKilledHandler.
If you can't use this code it's pretty fucking obvious you should'nt be using any code at all.

You all just got fucking rolled so drop this bullshit about code ripping.
Reppin' 127.0.0.1!!!<br><br><img src='http://img502.imageshack.us/img502/1348/sig4daxbn2.jpg' border='0' alt='user posted image' /><br><br>I contend that we are both atheists. I just believe in one fewer god than you do. <br>When you understand why you dismiss all the other possible gods, you will <br>understand why I dismiss yours.<br>~ <b>Stephen Roberts</b>
Post Reply