How to make a gun check its ammo

hello guys, i’m trying to make a gun that will check to see if it’s secondary/alt ammo is greater than 0 before firing, and to make a loopable fire sound, think you can help a simple coder? i’m relatively new to lua, so, i’m just seeking help for future weapons.

Thank you

self:Clip1() and self:Clip2()

how would i put that as an if then statement? i have this but it doesnt work so far…

function SWEP:SecondaryAttack()
if (!self:Clip2()) >0 then return end
self:TakeSecondaryAmmo(self.Secondary.TakeAmmo)
self:SetNextPrimaryFire( CurTime() + self.Secondary.Delay )
self:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )

 	local ply=self.Owner
 	local tr = self.Owner:GetEyeTrace()


 	shootPos=self.Owner:GetShootPos()+self.Owner:GetAimVector()+self.Owner:GetRight()*16+self.Owner:GetForward()*128-self.Owner:GetUp()*16

self.muzzle = self.Owner:GetViewModel():LookupAttachment(“muzzle”)

 	local ply=self.Owner
 	local tr = self.Owner:GetEyeTrace()

local tr = self.Owner:GetEyeTrace()
 util.ParticleTracerEx("merasmus_zap_beam_bits",shootPos,tr.HitPos,0,1,11 )

end

[editline]27th October 2015[/editline]

everything else works fine if that if then statement is removed

You have stated:
[lua]if (!self:Clip2()) > 0 then return end[/lua]
I’m sure this is meant to be:
[lua]if self:Clip2() < 1 then return end[/lua]

thank you! that works very well, now, how would i make a loopable sound go with it and stop when i stop firing, take note that this loop is 20 seconds in length, and i only want it to start when i fire and continue looping until the clip runs out of ammo/until i stop firing?

[editline]27th October 2015[/editline]

i can find a shorter loop as well, so it won’t have to be as lengthy