2
0
mirror of https://github.com/rehlds/reapi.git synced 2025-04-24 07:13:32 +03:00

Minor fixes (#193)

* fix rg_remove_items_by_slot c4 slot
* fix rg_remove_items_by_slot weapon hud
* add RG_SpawnRandomGibs victim arg
This commit is contained in:
Vaqtincha 2021-06-19 02:12:40 +05:00 committed by GitHub
parent 23cf192477
commit 1156a49c7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 23 deletions

View File

@ -395,7 +395,7 @@ enum GamedllFunc
/*
* Description: -
* Params: (int cGibs, int human)
* Params: (pevVictim, cGibs, human)
*/
RG_SpawnRandomGibs,
};

View File

@ -875,26 +875,39 @@ cell AMX_NATIVE_CALL rg_remove_items_by_slot(AMX *amx, cell *params)
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
CHECK_CONNECTED(pPlayer, arg_index);
pPlayer->ForEachItem(params[arg_slot], [pPlayer](CBasePlayerItem *pItem)
if (params[arg_slot] == C4_SLOT)
{
if (pItem->IsWeapon()) {
if (pItem == pPlayer->m_pActiveItem) {
((CBasePlayerWeapon *)pItem)->RetireWeapon();
pPlayer->CSPlayer()->RemovePlayerItemEx("weapon_c4", true);
}
else
{
pPlayer->ForEachItem(params[arg_slot], [pPlayer](CBasePlayerItem *pItem)
{
if (pItem->IsWeapon()) {
if (pItem == pPlayer->m_pActiveItem) {
((CBasePlayerWeapon *)pItem)->RetireWeapon();
}
pPlayer->m_rgAmmo[ pItem->PrimaryAmmoIndex() ] = 0;
}
pPlayer->m_rgAmmo[ pItem->PrimaryAmmoIndex() ] = 0;
if (pPlayer->RemovePlayerItem(pItem)) {
pPlayer->pev->weapons &= ~(1 << pItem->m_iId);
// No more weapon
if ((pPlayer->pev->weapons & ~(1 << WEAPON_SUIT)) == 0) {
pPlayer->m_iHideHUD |= HIDEHUD_WEAPONS;
}
pItem->Kill();
}
return false;
});
if (!pPlayer->m_rgpPlayerItems[PRIMARY_WEAPON_SLOT]) {
pPlayer->m_bHasPrimary = false;
}
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;