2
0
mirror of https://github.com/rehlds/reapi.git synced 2025-01-01 01:25:47 +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: - * Description: -
* Params: (int cGibs, int human) * Params: (pevVictim, cGibs, human)
*/ */
RG_SpawnRandomGibs, RG_SpawnRandomGibs,
}; };

View File

@ -875,6 +875,12 @@ cell AMX_NATIVE_CALL rg_remove_items_by_slot(AMX *amx, cell *params)
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]); CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
CHECK_CONNECTED(pPlayer, arg_index); CHECK_CONNECTED(pPlayer, arg_index);
if (params[arg_slot] == C4_SLOT)
{
pPlayer->CSPlayer()->RemovePlayerItemEx("weapon_c4", true);
}
else
{
pPlayer->ForEachItem(params[arg_slot], [pPlayer](CBasePlayerItem *pItem) pPlayer->ForEachItem(params[arg_slot], [pPlayer](CBasePlayerItem *pItem)
{ {
if (pItem->IsWeapon()) { if (pItem->IsWeapon()) {
@ -887,6 +893,12 @@ cell AMX_NATIVE_CALL rg_remove_items_by_slot(AMX *amx, cell *params)
if (pPlayer->RemovePlayerItem(pItem)) { if (pPlayer->RemovePlayerItem(pItem)) {
pPlayer->pev->weapons &= ~(1 << pItem->m_iId); 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(); pItem->Kill();
} }
@ -896,6 +908,7 @@ cell AMX_NATIVE_CALL rg_remove_items_by_slot(AMX *amx, cell *params)
if (!pPlayer->m_rgpPlayerItems[PRIMARY_WEAPON_SLOT]) { if (!pPlayer->m_rgpPlayerItems[PRIMARY_WEAPON_SLOT]) {
pPlayer->m_bHasPrimary = false; pPlayer->m_bHasPrimary = false;
} }
}
return TRUE; return TRUE;
} }