Disable attacking

I have a swep that changes hold type while USE is pressed.


if self.Owner:KeyDown( IN_USE ) then
self:SetWeaponHoldType("normal")
end

But the player can still primary/secondary attack. So how can I prevent that?

Weapon:GetHoldType

SWEP:CanPrimaryAttack

SWEP:CanSecondaryAttack

If you are setting the holdtype in the PrimaryAttack, what you probably want is just an empty return



if self.Owner:KeyDown( IN_USE ) then
    self:SetWeaponHoldType("normal")
    return
end


Thanks! Ended up with a combination of both.


function SWEP:PrimaryAttack()
if self.Owner:KeyDown( IN_USE ) then
return false
end