Point shop ammo

I’ve been trying to figure out a way to give ammo to any gun from the point shop when you buy it but I don’t know how to do this been look for a few days now any help would be appreciated

I used this code on my TTT server 2 yers ago:


ITEM.Name = 'Ammo 357'
ITEM.Price = 25
ITEM.Model = 'models/items/357ammo.mdl'
ITEM.AmmoClass = 'item_ammo_357_ttt'
ITEM.SingleUse = false
ITEM.NoPreview = true

function ITEM:OnBuy(ply)
	ply:Give(self.AmmoClass)
	ply:PS_TakeItem(ITEM.ID)
end

thats great but I mean I want something that give ammo to all my guns if that’s possible?

  1. Use http://wiki.garrysmod.com/page/Player/GetWeapons to get list of weapons
  2. Use for pairs loop
  3. Get ammo type of any weapon that player got (SWEP.Primary(Secondary)*.Ammo*) and use http://wiki.garrysmod.com/page/Player/GiveAmmo to give him this ammo type