Skip to content

Commit 6c47f96

Browse files
authored
Fix player_weaponstrip (#735)
* fix player_weaponstrip
1 parent db76e60 commit 6c47f96

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

regamedll/dlls/player.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6667,7 +6667,7 @@ void CBasePlayer::HandleSignals()
66676667
m_signals.Signal(SIGNAL_BOMB);
66686668
}
66696669
}
6670-
#endif
6670+
#endif
66716671

66726672
if (!CSGameRules()->m_bMapHasBombZone)
66736673
OLD_CheckBombTarget(this);
@@ -8401,7 +8401,13 @@ void CStripWeapons::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
84018401
{
84028402
if (m_iszSpecialItem)
84038403
{
8404-
pPlayer->CSPlayer()->RemovePlayerItem(STRING(m_iszSpecialItem));
8404+
const char *weaponName = STRING(m_iszSpecialItem);
8405+
WeaponSlotInfo *slotInfo = GetWeaponSlot(weaponName);
8406+
8407+
if (slotInfo != nullptr && slotInfo->slot == GRENADE_SLOT)
8408+
pPlayer->CSPlayer()->RemovePlayerItemEx(weaponName, true);
8409+
else
8410+
pPlayer->CSPlayer()->RemovePlayerItem(weaponName);
84058411
}
84068412

84078413
for (int slot = PRIMARY_WEAPON_SLOT; slot <= ALL_OTHER_ITEMS; slot++)
@@ -8422,7 +8428,11 @@ void CStripWeapons::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
84228428
{
84238429
pPlayer->ForEachItem(slot, [pPlayer](CBasePlayerItem *pItem)
84248430
{
8425-
pPlayer->CSPlayer()->RemovePlayerItem(STRING(pItem->pev->classname));
8431+
if (pItem->iItemSlot() == GRENADE_SLOT)
8432+
pPlayer->CSPlayer()->RemovePlayerItemEx(STRING(pItem->pev->classname), true);
8433+
else
8434+
pPlayer->CSPlayer()->RemovePlayerItem(STRING(pItem->pev->classname));
8435+
84268436
return false;
84278437
});
84288438
}

0 commit comments

Comments
 (0)