mirror of
https://github.com/rehlds/reapi.git
synced 2024-12-29 08:05:36 +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);
|
CHECK_CONNECTED(pPlayer, arg_index);
|
||||||
|
|
||||||
pPlayer->ForEachItem(params[arg_slot], [pPlayer](CBasePlayerItem *pItem) {
|
pPlayer->ForEachItem(params[arg_slot], [pPlayer](CBasePlayerItem *pItem) {
|
||||||
pPlayer->pev->weapons &= ~(1 << pItem->m_iId);
|
|
||||||
pPlayer->RemovePlayerItem(pItem);
|
if (pItem->IsWeapon() && pItem == pPlayer->m_pActiveItem) {
|
||||||
pItem->Kill();
|
((CBasePlayerWeapon *)pItem)->RetireWeapon();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pPlayer->RemovePlayerItem(pItem)) {
|
||||||
|
pPlayer->pev->weapons &= ~(1 << pItem->m_iId);
|
||||||
|
pItem->Kill();
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!pPlayer->m_rgpPlayerItems[PRIMARY_WEAPON_SLOT]) {
|
||||||
|
pPlayer->m_bHasPrimary = false;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user