diff --git a/dist/game.cfg b/dist/game.cfg index e05adc42..7cd5f88b 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -93,6 +93,7 @@ mp_auto_reload_weapons 0 // 0 - disabled (default behaviour) // 1 - refill backpack ammo on player spawn // 2 - refill backpack ammo on player spawn and on the purchase of the item +// 3 - refill backpack ammo on each weapon reload (NOTE: Useful for mods like DeathMatch, GunGame, ZombieMod etc.) // // Default value: "0" mp_refill_bpammo_weapons 0 diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 5b753bb4..1fbdc231 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -917,7 +917,15 @@ void CBasePlayerWeapon::ItemPostFrame() // Add them to the clip m_iClip += j; - m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j; + +#ifdef REGAMEDLL_ADD + // Do not remove bpammo of the player, + // if cvar allows to refill bpammo on during reloading the weapons + if (refill_bpammo_weapons.value < 3.0f) +#endif + { + m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j; + } m_pPlayer->TabulateAmmo(); m_fInReload = FALSE; @@ -1436,8 +1444,15 @@ bool EXT_FUNC CBasePlayerWeapon::__API_HOOK(DefaultShotgunReload)(int iAnim, int #endif { m_iClip++; - m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--; - m_pPlayer->ammo_buckshot--; + +#ifdef REGAMEDLL_ADD + if (refill_bpammo_weapons.value < 3.0f) +#endif + { + m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--; + m_pPlayer->ammo_buckshot--; + } + m_fInSpecialReload = 1; }