2
0
mirror of https://github.com/rehlds/reapi.git synced 2024-12-28 15:45:31 +03:00

Improves native rg_remove_items_by_slot

This commit is contained in:
s1lentq 2017-01-23 18:59:39 +07:00
parent 681f1a3cd7
commit 7f12e999e6

View File

@ -806,12 +806,23 @@ cell AMX_NATIVE_CALL rg_remove_items_by_slot(AMX *amx, cell *params)
CHECK_CONNECTED(pPlayer, arg_index);
pPlayer->ForEachItem(params[arg_slot], [pPlayer](CBasePlayerItem *pItem) {
pPlayer->pev->weapons &= ~(1 << pItem->m_iId);
pPlayer->RemovePlayerItem(pItem);
pItem->Kill();
if (pItem->IsWeapon() && pItem == pPlayer->m_pActiveItem) {
((CBasePlayerWeapon *)pItem)->RetireWeapon();
}
if (pPlayer->RemovePlayerItem(pItem)) {
pPlayer->pev->weapons &= ~(1 << pItem->m_iId);
pItem->Kill();
}
return false;
});
if (!pPlayer->m_rgpPlayerItems[PRIMARY_WEAPON_SLOT]) {
pPlayer->m_bHasPrimary = false;
}
return TRUE;
}