• Get 'SWEP.Primary.DefaultClip' of a SWEP?
    4 replies, posted
Is it possible to retrieve attribute values from a SWEP. For example, [CODE]SWEP.Primary.DefaultClip = 6[/CODE] I tested it with this, but I get a nil value. [CODE]print(SWEP.Primary.DefaultClip)[/CODE]
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 [LUA] if self.Primary.DefaultClip < self:Clip1() then return end [/LUA] ?
How can I get the amount of ammo in the clip? I'm using this, which gives me the total amount of bullets. [CODE] self.Owner:GetAmmoCount(self.Owner:GetActiveWeapon():GetPrimaryAmmoType()) [/CODE] [editline]11th May 2014[/editline] [QUOTE=rejax;44779645] are you trying to do [LUA] if self.Primary.DefaultClip < self:Clip1() then return end [/LUA] ?[/QUOTE] Yep, that's it.
Sorry, you need to Log In to post a reply to this thread.