From 6c47f96998c3780e80675a43f9d148eb87659165 Mon Sep 17 00:00:00 2001 From: Vaqtincha <51029683+Vaqtincha@users.noreply.github.com> Date: Sat, 16 Apr 2022 17:11:13 +0500 Subject: [PATCH] Fix player_weaponstrip (#735) * fix player_weaponstrip --- regamedll/dlls/player.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 802d008a..3b51675b 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -6667,7 +6667,7 @@ void CBasePlayer::HandleSignals() m_signals.Signal(SIGNAL_BOMB); } } -#endif +#endif if (!CSGameRules()->m_bMapHasBombZone) OLD_CheckBombTarget(this); @@ -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; }); }