• RemoveAmmo function on my SWEP isn't working
    1 replies, posted
My gun fires regardless of ammo, so I told it to stop firing after ten shots with a different variable. But to give the player some way to tell when they're no longer going to be able to shoot, I wanted to decrease their ammo by one every shot. [CODE] SWEP.Primary.ClipSize = 10 SWEP.Primary.DefaultClip = 10 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "AR2" SWEP.Secondary.ClipSize = 1 SWEP.Secondary.DefaultClip = 1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "AR2" function SWEP:PrimaryAttack() self.Owner:RemoveAmmo(1, "AR2") end[/CODE] In my actual code, there's more that happens in PrimaryAttack(), so I'm 100% sure that it's running. This produces no error message. To my knowledge, I should be able to see the ammo in the clip on the lower left on the screen decrease by 1, but that is not happening.
[code]self:TakePrimaryAmmo()[/code]
Sorry, you need to Log In to post a reply to this thread.