Get 'SWEP.Primary.DefaultClip' of a SWEP?

Is it possible to retrieve attribute values from a SWEP.

For example,

SWEP.Primary.DefaultClip = 6

I tested it with this, but I get a nil value.


Where are you trying to get it? In SWEP:PrimaryFire? use self. instead of SWEP. inside SWEP:* functions.

Alright, that works.

I’m trying to compare the default amount of ammo to the amount in the gun.

if it’s not in a swep function, use
[LUA]weapons.Get( “your_weapon” ).Primary.DefaultClip[/LUA]

[editline]11th May 2014[/editline]

oops, you ninjad me

are you trying to do
if self.Primary.DefaultClip < self:Clip1() then return end

How can I get the amount of ammo in the clip?

I’m using this, which gives me the total amount of bullets.


[editline]11th May 2014[/editline]

Yep, that’s it.