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:
parent
681f1a3cd7
commit
7f12e999e6
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user