2
0
mirror of https://github.com/rehlds/reapi.git synced 2024-12-28 15:45:31 +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,
};
@ -777,13 +777,13 @@ enum GamedllFunc_CBasePlayer
* Params: (const this)
*/
RG_CBasePlayer_UseEmpty,
/*
* Description: Called when a idle player is removed from server.
* Return type: void
* Params: (const this, const reason[])
*/
RG_CBasePlayer_DropIdlePlayer,
RG_CBasePlayer_DropIdlePlayer,
};
/**
@ -4522,7 +4522,7 @@ enum CCSPlayer_Members
* Set params: set_member(index, member, Float:value);
*/
m_flSpawnProtectionEndTime,
/*
* Description: -
* Member type: class Vector
@ -5996,7 +5996,7 @@ enum CGib_Members
* Set params: set_member(index, member, value);
*/
m_Gib_bloodColor = BEGIN_MEMBER_REGION(gib),
/*
* Description: -
* Member type: int
@ -6004,7 +6004,7 @@ enum CGib_Members
* Set params: set_member(index, member, value);
*/
m_Gib_cBloodDecals,
/*
* Description: -
* Member type: int
@ -6012,7 +6012,7 @@ enum CGib_Members
* Set params: set_member(index, member, value);
*/
m_Gib_material,
/*
* Description: -
* Member type: float

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;