Zet0rz / nZombies-Unlimited

nZombies Unlimited
MIT License
43 stars 15 forks source link

Defineable Max Ammo Amount? #62

Open unit0016 opened 5 years ago

unit0016 commented 5 years ago

Suggestion, of course: The ability to define a "max ammo" amount for guns that either don't have one, or have one that's too high. Currently, weapons that don't have one seem to default to 10 bullets when bought off a wall.

Chtidino commented 4 years ago

I do not know, if it is the best method, but, I add that in the .lua of the weapons (TFA) to personalize the number of ammunition in stock.

--------------------------------------
function SWEP:CalculateMaxAmmo()

    local ammo_type = self:GetPrimaryAmmoType() or self.Primary.Ammo

    if SERVER then
        self.Owner:SetAmmo( self.Primary.MaxAmmo , ammo_type )
    self:SetClip1( self.Primary.ClipSize )
    end
end

SWEP.Primary.MaxAmmo = 80
--------------------------------------