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

@ -6667,7 +6667,7 @@ void CBasePlayer::HandleSignals()
m_signals.Signal(SIGNAL_BOMB); m_signals.Signal(SIGNAL_BOMB);
} }
} }
#endif #endif
if (!CSGameRules()->m_bMapHasBombZone) if (!CSGameRules()->m_bMapHasBombZone)
OLD_CheckBombTarget(this); OLD_CheckBombTarget(this);
@ -8401,7 +8401,13 @@ void CStripWeapons::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
{ {
if (m_iszSpecialItem) 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++) 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->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; return false;
}); });
} }