Unlimited ammo on a gun

Hey guys, sorry if this is a pretty stupid question, but I couldn’t find any help on this anywhere else. (I’ve tried fixing it myself, but was not successful.) I got the Nyan Gun swep, but I’m not sure how to make it so that the gun doesn’t have unlimited ammo. I set the clip size and default clip size to 100, but the amount of ammo isn’t going down at all. Can anyone help?

Link to SWEP: http://steamcommunity.com/sharedfiles/filedetails/?id=123277559

Post the source here and we can try to fix it.

Be sure nothing with the Clips/Ammo is -1;
That makes it unlimited.

Whenever the SWep is being fired, try adding in this snipet:
[lua]self:TakePrimaryAmmo(self.Primary.TakeAmmo)[/lua]
Which does as it says; Taking ammo from the primary clip.

Alright, here it is.

http://pastebin.com/h2bEiaQ9

I tried this, but got too many lua errors.

huh well I’d like to help you but I can’t even get it to spawn in game

I appreciate you trying to help.

If you are too dumb to fix the errors then why even bother?


self:TakePrimaryAmmo( 1 )

No need to be a dick about it, if I knew how to do it myself I would. I’ve already tried your code before you posted that, didn’t work.

You are probably putting it into incorrect place.

I ended up getting the ammo working, but when you run out it still allows you to shoot.

Thank you for your help Panda.