How do I get extra ammo for guns in TTT?

Basically, I am looking for a way to make guns come with full ammo. Whether it be the guns on the ground that spawn by default, or ones that players spawn in with each round.

I was told by someone to edit the “SWEP.Primary.DefaultClip” value to a higher amount to make guns come with more ammo.
Although it does work, it also makes the guns have unlimited ammo essentially and it is even more buggy with a weapon quick swap script.

With a weapon quick swap script, it detects the “SWEP.Primary.DefaultClip” value and displays to the user that the gun has, for example, 90 shots since the “SWEP.Primary.DefaultClip = 90”. So that the gun can have 30 in the clip and 60 in reserve. When you quick swap, it gives you the gun with 90 shots in the clip. (Most likely poor coding on the quick swap script, but I could be wrong.)

So basically the “SWEP.Primary.DefaultClip” value, has to be mirrored with “SWEP.Primary.ClipSize” value, or you can just drop the gun on the ground then pick it back up to get all your ammo back. In turn, making the gun have unlimited ammo.

I was wondering if there was a way to make it so the m16 for example comes with 60 extra ammo, including the clip it already comes with.
It would be nice if the gamemode added a new string, or whatever it is called, to the weapon code.

Something like “SWEP.Primary.ExtraAmmo = 60” then the gun would spawn with extra ammo.

I find that some maps do not spawn enough ammo and I was looking for a way to have players pre-stocked with ammunition.

The ExtraAmmo var will work, you just need to set it up. DefaultClip calls on pickup (or SWEP:Deploy), but overwriting it wont fix that.

function SWEP:Initialize()
-- rest of init code

I don’t think Initialize gets called on pickup so, this should work.

silenced pistol:

-- We were bought as special equipment, and we have an extra to give
function SWEP:WasBought(buyer)
   if IsValid(buyer) then -- probably already self.Owner
      buyer:GiveAmmo( 20, "Pistol" )

That’s only called when a player buys the weapon from the equipment menu, picking it up won’t do anything.