Fix player_weaponstrip (#735)

* fix player_weaponstrip
This commit is contained in:
Vaqtincha 2022-04-16 17:11:13 +05:00 committed by GitHub
parent db76e604df
commit 6c47f96998
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8401,7 +8401,13 @@ void CStripWeapons::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
{
if (m_iszSpecialItem)
{
pPlayer->CSPlayer()->RemovePlayerItem(STRING(m_iszSpecialItem));
const char *weaponName = STRING(m_iszSpecialItem);
WeaponSlotInfo *slotInfo = GetWeaponSlot(weaponName);
if (slotInfo != nullptr && slotInfo->slot == GRENADE_SLOT)
pPlayer->CSPlayer()->RemovePlayerItemEx(weaponName, true);
else
pPlayer->CSPlayer()->RemovePlayerItem(weaponName);
}
for (int slot = PRIMARY_WEAPON_SLOT; slot <= ALL_OTHER_ITEMS; slot++)
@ -8422,7 +8428,11 @@ void CStripWeapons::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
{
pPlayer->ForEachItem(slot, [pPlayer](CBasePlayerItem *pItem)
{
pPlayer->CSPlayer()->RemovePlayerItem(STRING(pItem->pev->classname));
if (pItem->iItemSlot() == GRENADE_SLOT)
pPlayer->CSPlayer()->RemovePlayerItemEx(STRING(pItem->pev->classname), true);
else
pPlayer->CSPlayer()->RemovePlayerItem(STRING(pItem->pev->classname));
return false;
});
}