View Single Post
Author Message
impossible_cc
Senior Member
Join Date: Sep 2018
Location: Ukraine
Old 01-13-2019 , 15:20   [CSGO] How to prevent reloading if you have too much ammo
Reply With Quote #1

For example, I want to give any weapon more ammo, then it could have normally -> I do this
PHP Code:
void GiveAmmoCurrentWeapon(int clientint amount)
{
    
int weaponIndex = -1;
//First we try to find weapon in slot0 (primary), if nothing was found check slot1(pistol)
    
for(int i 0<= && weaponIndex == -i++)
    {
        
weaponIndex GetPlayerWeaponSlot(clienti);
    }
//if we have found a weapon
    
if(weaponIndex != -&& IsValidEdict(weaponIndex))
    {
//Set reserve ammo
        
SetEntProp(weaponIndexProp_Send"m_iPrimaryReserveAmmoCount"GetEntProp(weaponIndexProp_Send"m_iPrimaryReserveAmmoCount") + amount);
//Set current ammo
        
SetEntProp(weaponIndexProp_Send"m_iClip1"GetEntProp(weaponIndexProp_Send"m_iClip1") + amount);
    }

Everything works fine except player with additive ammo can press reload button and game will allow him to do it, ammo will be reseted to normal. Is there any way to prevent reloading if you have too much ammo?

Last edited by impossible_cc; 01-14-2019 at 07:12.
impossible_cc is offline