Function not working

[lua]function SWEP:OnHit( tr )
local ent = tr.Entity
if ( !IsValid( ent ) ) then self:PlayHitSound() return end
if ( CLIENT ) then return end

if ( ent:Health() > 0 ) then
	if ( ent:IsNPC() ) then
	self.Owner:SendMessage( "Can't damage NPC's with this, build a weapon!", 4, Color( 200, 0, 0, 255 ) )
	self:PlayHitSound()
	elseif ( ent:IsPlayer() && GetConVarNumber( "gms_PVPDamage" ) > 0 ) then
	ent:TakeDamage( self.Primary.Damage, self.Owner, self )
	self:PlayHitSound()
	end
else
	self:DoToolHit( ent )
end

end[/lua]

When I hit someone with any tool (a player) it displays the self.Owner:SendMessage and does no damage, even if I set te ConVar for the PvPDamage to 1.

[editline]19th November 2013[/editline]

This is the base swep for all the tools on the gamemode

swapping the if and elseif fixed it, no idea why but it’s solved now.