[Src] /dkset >> update

Codes already submitted by people of the forums.
Post Reply
Ovl
just visiting
Posts: 5
Joined: Fri Jun 16, 2006 2:28 am

Post by Ovl »

the code this this based on the code of drawjer”and modified by my so that single it is used in cityhall_X and has built-in so that when you receive dkset disconnects you to avoid flood.

go to function ChatMsgHandler and add:

Code: Select all

  if (memcmp(cp, "/dkset", 6) == 0) {
            GetDkSet(iClientH);
            return;
  }
later to add this at the end of game.cpp

Code: Select all

//dkset by diuude and update by drawjer and modified by Ovl
void CGame::GetDkSet(int iClientH) 
{
	
class CItem * pItem;
int dkM[]={706,707,708,710};
int dkW[]={724,725,726,728};
int dmM[]={711,712,713,717};
int dmW[]={729,730,731,717};
int weapon, iItemID, i, iEraseReq;
if(m_pClientList[iClientH] == NULL) return;
if&#40;m_pClientList&#91;iClientH&#93;->m_iLevel < 180&#41; return;
if &#40;&#40;&#40;strcmp&#40;m_pMapList&#91;m_pClientList&#91;iClientH&#93;->m_cMapIndex&#93;->m_cName, "cityhall_1"&#41; == 0&#41; || &#40;strcmp&#40;m_pMapList&#91;m_pClientList&#91;iClientH&#93;->m_cMapIndex&#93;->m_cName, "cityhall_2"&#41; == 0&#41;&#41;&#41; &#123;
for &#40;i = 0; i <= 4; i++&#41;
&#123;
 pItem = new class CItem;
 iItemID=-1;
 if &#40;m_pClientList&#91;iClientH&#93;->m_cSex == 1&#41;
 &#123;
 &nbsp;if &#40;m_pClientList&#91;iClientH&#93;->m_iStr > 100&#41;
 &nbsp;&#123;
 &nbsp; iItemID=dkM&#91;i&#93;;
 &nbsp;&#125;
 &nbsp;else
 &nbsp;&#123;
 &nbsp; iItemID=dmM&#91;i&#93;;
 &nbsp;&#125;
 &#125;
 else
 &#123;
 &nbsp;if &#40;m_pClientList&#91;iClientH&#93;->m_iStr > 100&#41;
 &nbsp;&#123;
 &nbsp; iItemID=dkW&#91;i&#93;;
 &nbsp;&#125;
 &nbsp;else
 &nbsp;&#123;
 &nbsp; iItemID=dmW&#91;i&#93;;
 &nbsp;&#125;
 &#125;
 if &#40;i == 4&#41;
 &#123;
 &nbsp;if &#40;m_pClientList&#91;iClientH&#93;->m_iStr > m_pClientList&#91;iClientH&#93;->m_iInt&#41;
 &nbsp;&#123; if &#40;m_pClientList&#91;iClientH&#93;->m_cSex == 1&#41;&#123;
 &nbsp; weapon=709;
 &nbsp;&#125; 
 &nbsp;else if &#40;m_pClientList&#91;iClientH&#93;->m_cSex == 2&#41;&#123;
 &nbsp; weapon=727;
 &nbsp;&#125;
 &nbsp;&#125;
 &nbsp;else
 &nbsp;&#123; if &#40;m_pClientList&#91;iClientH&#93;->m_cSex == 1&#41;&#123;
 &nbsp; weapon=714;
 &nbsp;&#125; 
 &nbsp;else if &#40;m_pClientList&#91;iClientH&#93;->m_cSex == 2&#41;&#123;
 &nbsp; weapon=732;
 &nbsp;&#125;
 &nbsp;&#125;
 &nbsp;iItemID = weapon;
 &#125;
 if &#40;iItemID != -1&#41; //if any error occures, dont crash character
 &#123;
 &nbsp;_bInitItemAttr&#40;pItem, iItemID&#41;;
 &nbsp;pItem->m_sTouchEffectType = DEF_ITET_UNIQUE_OWNER;
 &nbsp;pItem->m_sTouchEffectValue1 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum1;
 &nbsp;pItem->m_sTouchEffectValue2 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum2;
 &nbsp;pItem->m_sTouchEffectValue3 = m_pClientList&#91;iClientH&#93;->m_sCharIDnum3;
 &nbsp;_bAddClientItemList&#40;iClientH, pItem, &iEraseReq&#41;;
 &nbsp;SendItemNotifyMsg&#40;iClientH, DEF_NOTIFY_ITEMOBTAINED, pItem, NULL&#41;;
 &nbsp;
 &#125;
&#125;
&#125; DeleteClient&#40;iClientH, TRUE, FALSE, TRUE&#41;;

&#125;
and to register the function in game.h

Code: Select all

	void GetDkSet&#40;int iClientH&#41;;
Drajwer
&lt;3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

updated by one line?
<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 »

*looks at code and cries* Too hard!
xmukox
Member
Posts: 175
Joined: Sun Sep 11, 2005 9:53 am

Post by xmukox »

lol that command rox^^ i can use it as some log out hack ^^ 2vs1 jaja i dont need die ./dkset (dc) haha ;f
Tafka12
&lt;3 bd long time
Posts: 772
Joined: Wed Dec 28, 2005 6:32 pm

Post by Tafka12 »

xmukox wrote: lol that command rox^^ i can use it as some log out hack ^^ 2vs1 jaja i dont need die ./dkset (dc) haha ;f
see this

if (((strcmp(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName, "cityhall_1") == 0) || (strcmp(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName, "cityhall_2")

you must be in city hall.
<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' />
adaraio
just visiting
Posts: 6
Joined: Mon Aug 14, 2006 8:40 pm

Post by adaraio »

I test the code, and if im not in cityhall and write /dkset i can disconect :P

well dc hack :blink:
adaraio
just visiting
Posts: 6
Joined: Mon Aug 14, 2006 8:40 pm

Post by adaraio »

Fixed

Code: Select all

//dkset by diuude and update by drawjer and modified by Ovl
void CGame::GetDkSet(int iClientH)
{

class CItem * pItem;
int dkM[]={706,707,708,710};
int dkW[]={724,725,726,728};
int dmM[]={711,712,713,717};
int dmW[]={729,730,731,717};
int weapon, iItemID, i, iEraseReq;
if(m_pClientList[iClientH] == NULL) return;
if(m_pClientList[iClientH]->m_iLevel < 180) return;
if (((strcmp(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName, "cityhall_1") == 0) ||
	(strcmp(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName, "cityhall_2") == 0))) {
for (i = 0; i <= 4; i++)
{
pItem = new class CItem;
iItemID=-1;
if (m_pClientList[iClientH]->m_cSex == 1)
{
 if (m_pClientList[iClientH]->m_iStr > 100)
 {
  iItemID=dkM[i];
 }
 else
 {
  iItemID=dmM[i];
 }
}
else
{
 if (m_pClientList[iClientH]->m_iStr > 100)
 {
  iItemID=dkW[i];
 }
 else
 {
  iItemID=dmW[i];
 }
}
if (i == 4)
{
 if (m_pClientList[iClientH]->m_iStr > m_pClientList[iClientH]->m_iInt)
 { if (m_pClientList[iClientH]->m_cSex == 1){
  weapon=709;
 }
 else if (m_pClientList[iClientH]->m_cSex == 2){
  weapon=727;
 }
 }
 else
 { if (m_pClientList[iClientH]->m_cSex == 1){
  weapon=714;
 }
 else if (m_pClientList[iClientH]->m_cSex == 2){
  weapon=732;
 }
 }
 iItemID = weapon;
}
if (iItemID != -1) //if any error occures, dont crash character
{
 _bInitItemAttr(pItem, iItemID);
 pItem->m_sTouchEffectType = DEF_ITET_UNIQUE_OWNER;
 pItem->m_sTouchEffectValue1 = m_pClientList[iClientH]->m_sCharIDnum1;
 pItem->m_sTouchEffectValue2 = m_pClientList[iClientH]->m_sCharIDnum2;
 pItem->m_sTouchEffectValue3 = m_pClientList[iClientH]->m_sCharIDnum3;
 _bAddClientItemList(iClientH, pItem, &iEraseReq);
 SendItemNotifyMsg(iClientH, DEF_NOTIFY_ITEMOBTAINED, pItem, NULL);
 
}
}
DeleteClient(iClientH, TRUE, FALSE, TRUE);
}
else
{
	SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, "No estas en la CityHall");
}
} 

Post Reply