November Source Bug/ Dupe Fix Release
#28


7 hours ago, Dimaflash said:




Hi guys. This is my code for it. Checking the type of weapon. Whether the item is a weapon or not =).



 - in doFuncItem.cpp




void do_ItemWear(CPC* ch, CNetMsg::SP& msg)




after:




case WEARING_ACCESSORY3:
{
int nOldState = ch->GetPlayerState();
ch->ResetPlayerState(PLAYER_STATE_SUPPORTER);
int i;
for (i = WEARING_ACCESSORY1; i <= WEARING_ACCESSORY3; i++)
{
if (ch->m_wearInventory.wearItemInfo[i])
{
if (ch->m_wearInventory.wearItemInfo[i]->m_itemProto->getItemIndex() == 1912)
ch->SetPlayerState(PLAYER_STATE_SUPPORTER);
}
}
if (nOldState != ch->GetPlayerState())
{
CNetMsg::SP rmsg(new CNetMsg);
ExPlayerStateChangeMsg(rmsg, ch);
ch->m_pArea->SendToCell(rmsg, ch, true);
}
}
break;




adding 1 more case:




case WEARING_WEAPON: // DmitryGreen
{
if (ch->m_wearInventory.wearItemInfo[WEARING_WEAPON]->m_itemProto->getItemTypeIdx() != ITYPE_WEAPON)
{
LOG_ERROR("HACKING? Error with slot Weapon charIndex[%d]", ch->m_index); // fix Weapon/Pet slot
ch->m_desc->Close("Invalid type WEAPON");
if (!ch->m_wearInventory.DelNormalItem(2))
ch->m_wearInventory.RemoveItem(2);
}
}
break;


 




Really nice! 



I've also added this line of code:

 

after:

void do_ItemWear(CPC* ch, CNetMsg::SP& msg)

add:

if (packet->wearPos != item->m_itemProto->getItemWearing())
{
CNetMsg::SP rmsg(new CNetMsg);
ResponseClient::ItemWearMsg(rmsg, ResponseClient::WEAR_ERR_INVALID_POS);
SEND_Q(rmsg, ch->m_desc);
return;
}

 



Messages In This Thread
[No subject] - by dethunter12 - 05-15-2021, 02:53 AM
[No subject] - by rondo157 - 05-15-2021, 03:16 AM
[No subject] - by dethunter12 - 05-15-2021, 04:21 AM
[No subject] - by BayBay - 05-15-2021, 04:26 AM
[No subject] - by Scura - 05-15-2021, 10:29 AM
[No subject] - by dethunter12 - 05-15-2021, 02:24 PM
[No subject] - by Reza - 05-15-2021, 03:07 PM
[No subject] - by BayBay - 05-15-2021, 09:37 PM
[No subject] - by dethunter12 - 05-16-2021, 03:41 AM
[No subject] - by BayBay - 05-16-2021, 03:43 AM
[No subject] - by dethunter12 - 05-16-2021, 03:48 AM
[No subject] - by BayBay - 05-16-2021, 04:11 AM
[No subject] - by Desarija - 05-16-2021, 08:19 AM
[No subject] - by Scura - 05-16-2021, 11:37 AM
[No subject] - by Reza - 05-16-2021, 01:49 PM
[No subject] - by BayBay - 05-16-2021, 09:05 PM
[No subject] - by dethunter12 - 05-16-2021, 09:09 PM
[No subject] - by WhosUrDaddi - 05-29-2021, 02:25 PM
[No subject] - by theDJ - 06-13-2021, 04:04 PM
[No subject] - by Veni - 06-13-2021, 04:34 PM
[No subject] - by Scura - 06-13-2021, 06:22 PM
[No subject] - by Veni - 06-13-2021, 06:32 PM
[No subject] - by Scura - 06-13-2021, 06:48 PM
[No subject] - by Veni - 06-13-2021, 07:13 PM
[No subject] - by theDJ - 06-13-2021, 07:15 PM
[No subject] - by Scura - 06-13-2021, 07:38 PM
[No subject] - by Dimaflash - 06-14-2021, 01:55 AM
[No subject] - by Scura - 06-14-2021, 09:16 AM
[No subject] - by Asylum - 11-16-2021, 03:34 PM
[No subject] - by dethunter12 - 11-16-2021, 05:48 PM
[No subject] - by Asylum - 11-16-2021, 06:49 PM
[No subject] - by nicolasg - 04-17-2022, 12:26 AM
[No subject] - by Tommy - 04-17-2022, 05:07 PM
[No subject] - by Scura - 04-20-2022, 01:12 PM
[No subject] - by Andrein95 - 04-27-2022, 09:07 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)