[REG] /showdmg

Submit your code requests, and if you are good at coding come help others with their requests.
Post Reply
Namesis
Regular
Posts: 88
Joined: Fri Mar 03, 2006 12:53 pm

Post by Namesis »

hi, i am searching fot the /showdmg src but i cant find it and the code of Jensen is wrong :( it gives some errors :( can someone post me one good? :lol:
BlueChristmas
Loyal fan
Posts: 216
Joined: Wed Apr 19, 2006 12:19 am

Post by BlueChristmas »

Namesis wrote: hi, i am searching fot the /showdmg src but i cant find it and the code of Jensen is wrong :( it gives some errors :( can someone post me one good? :lol:
you sure the errors aren't your fault?
<img src='http://img114.imageshack.us/img114/8618 ... 2dy3lx.jpg' border='0' alt='user posted image' />
Namesis
Regular
Posts: 88
Joined: Fri Mar 03, 2006 12:53 pm

Post by Namesis »

ya
Jensen
Loyal fan
Posts: 300
Joined: Tue Aug 02, 2005 7:40 am
Location: Illinois, USA
Contact:

Post by Jensen »

if your error looks like this its your fault

<!--QuoteBegin-"jorge_mml@hotmail.com"+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE ("jorge_mml@hotmail.com")</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->

Code: Select all

(1:29:21 PM)  C:\Documents and Settings\Jorge Maldonado\Mis documentos\server\Nueva carpeta (7)\Game.cpp(57691) : error C2039: 'm_iShowDamage' : is not a member of 'CClient'         
C:\Documents and Settings\Jorge Maldonado\Mis documentos\server\Nueva carpeta (7)\Client.h(36) : see declaration of 'CClient' 
C:\Documents and Settings\Jorge Maldonado\Mis documentos\server\Nueva carpeta (7)\Game.cpp(57693) : error C2039: 'm_iShowDamage' : is not a member of 'CClient'         
C:\Documents and Settings\Jorge Maldonado\Mis documentos\server\Nueva carpeta (7)\Client.h(36) : see declaration of 'CClient' C:\Documents and Settings\Jorge Maldonado\Mis documentos\server\Nueva carpeta (7)\Game.cpp(57696) : error C2039: 'm_iShowDamage' : is not a member of 'CClient'         
C:\Documents and Settings\Jorge Maldonado\Mis documentos\server\Nueva carpeta (7)\Client.h(36) : see declaration of 'CClient' 
[/quote]

what i posted is exactly what was requested, the command, i didnt post anything needed to initalize vars, save to char files, actually display them etc...
-><-
molo
Member
Posts: 140
Joined: Mon Jan 17, 2005 1:19 am

Post by molo »

btw... can you post /showdmg code for me? ;)

would be nice to share with people :)
Namesis
Regular
Posts: 88
Joined: Fri Mar 03, 2006 12:53 pm

Post by Namesis »

lol ya :ph34r: :o
Maldo
just visiting
Posts: 5
Joined: Fri Jun 02, 2006 7:13 pm

Post by Maldo »

Jensen wrote: if your error looks like this its your fault

<!--QuoteBegin-"jorge_mml@hotmail.com"+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE ("jorge_mml@hotmail.com")</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->

Code: Select all

(1:29:21 PM)  C:\Documents and Settings\Jorge Maldonado\Mis documentos\server\Nueva carpeta (7)\Game.cpp(57691) : error C2039: 'm_iShowDamage' : is not a member of 'CClient'         
C:\Documents and Settings\Jorge Maldonado\Mis documentos\server\Nueva carpeta (7)\Client.h(36) : see declaration of 'CClient' 
C:\Documents and Settings\Jorge Maldonado\Mis documentos\server\Nueva carpeta (7)\Game.cpp(57693) : error C2039: 'm_iShowDamage' : is not a member of 'CClient'         
C:\Documents and Settings\Jorge Maldonado\Mis documentos\server\Nueva carpeta (7)\Client.h(36) : see declaration of 'CClient' C:\Documents and Settings\Jorge Maldonado\Mis documentos\server\Nueva carpeta (7)\Game.cpp(57696) : error C2039: 'm_iShowDamage' : is not a member of 'CClient'         
C:\Documents and Settings\Jorge Maldonado\Mis documentos\server\Nueva carpeta (7)\Client.h(36) : see declaration of 'CClient' 
what i posted is exactly what was requested, the command, i didnt post anything needed to initalize vars, save to char files, actually display them etc... [/quote]
jajaj lol thats my mail :D
ADDKiD
&lt;3 bd long time
Posts: 967
Joined: Tue Jul 12, 2005 8:07 pm
Location: Washington, USA
Contact:

Post by ADDKiD »

lol?
Jensen
Loyal fan
Posts: 300
Joined: Tue Aug 02, 2005 7:40 am
Location: Illinois, USA
Contact:

Post by Jensen »

molo wrote: btw... can you post /showdmg code for me? ;)

would be nice to share with people :)
since you asked so nicely ill post a bit of it, but im going to repeat 1 more time, you will get an error like i just posted with what i put here, if you cant do something as simple as fix that error dont use these codes

in ChatMsgHandler

Code: Select all

if (memcmp(cp, "/showdmglog", 11) == 0) {
    AdminOrder_ShowDamageLog(iClientH);
    return;
  	}
 
  	if (memcmp(cp, "/showdmg", 8) == 0) {
    AdminOrder_ShowDamage(iClientH);
    return;
  	}
handelers for the above calls

Code: Select all

void CGame::AdminOrder_ShowDamage(int iClientH)
{
	char cStatMessage[80];
	if (m_pClientList[iClientH] == NULL) return;
	if(m_pClientList[iClientH]->m_iShowDamage == 1)
	{
  m_pClientList[iClientH]->m_iShowDamage = 0;
  wsprintf(cStatMessage, "Command: ShowDamage Disabled");
	}else{
  m_pClientList[iClientH]->m_iShowDamage = 1;
  wsprintf(cStatMessage, "Command: ShowDamage Enabled");
  
	}
	ShowClientMsg(iClientH, cStatMessage);
	return;
}

and the function that uses those varibles



void CGame::AdminOrder_ShowDamageLog(int iClientH)
{
	char cStatMessage[80];
	if (m_pClientList[iClientH] == NULL) return;
	if(m_pClientList[iClientH]->m_iShowDamage == 2)
	{
  m_pClientList[iClientH]->m_iShowDamage = 0;
  wsprintf(cStatMessage, "Command: ShowDamageLog Disabled");
	}else{
  m_pClientList[iClientH]->m_iShowDamage = 2;
  wsprintf(cStatMessage, "Command: ShowDamageLog Enabled");
	}
	
	ShowClientMsg(iClientH, cStatMessage);
	return;
}

Code: Select all

 void CGame::ShowClientDmg(int iClientH,char cTargetType, int iTargetH ,int iDamage){
  char cInfoString[80];
 
  if(cTargetType == DEF_OWNERTYPE_PLAYER){
  	ZeroMemory(cInfoString, sizeof(cInfoString));
  	wsprintf(cInfoString, "Player(%s) Level(%i) Damage(%i)",m_pClientList[iTargetH]->m_cCharName, 
  	m_pClientList[iTargetH]->m_iLevel,	iDamage);
  }
  if(cTargetType == DEF_OWNERTYPE_NPC){
  	ZeroMemory(cInfoString, sizeof(cInfoString));
  	wsprintf(cInfoString, "Npc(%s) Damage(%i)",m_pNpcList[iTargetH]->m_cNpcName, iDamage);
  }
  if( m_pClientList[iClientH]->m_iShowDamage == 1)
  {
  	SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_IPACCOUNTINFO, NULL, NULL, NULL, cInfoString);
  }else{
  	ShowClientMsg(iClientH, cInfoString);
  }
  return;
 }
on a side note, make sure that when this function is called the attackertype is a player, and that they have it enabled (!=0)

you could very easily inline this function, or check if its enabled in it, but i didnt feel like doing either (first because if its not being used it seems like unessecary bloat in the function, and the second for unnessecary functions calls if unused.

anything else, lemme know. theres enough information here to implement this now.
-><-
Post Reply