Melee SWEP problem.

I am working on a melee SWEP for my server, sadly I am getting two problems.

First, the hit detection is awful. Is there anything I can do to improve it?

Second, when someone hits an invisible barrier with it, a bullet comes out the other side and is capable of hurting others at long range. How would I stop this? (See the image below.)

(Map is deathrun_family_guy_final2 if you need it for testing.)

Here is the SWEP code:
[lua]
SWEP.Category = “Some Sweps”
SWEP.PrintName = “Axe”
SWEP.Author = “”
SWEP.Instructions = “Hit people.”
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = “None”
SWEP.FiresUnderwater = true
SWEP.Weight = 3
SWEP.AutoSwitchTo = true
SWEP.Slot = 1
SWEP.SlotPos = 1
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true
SWEP.ViewModel = “models/weapons/v_axe.mdl”
SWEP.WorldModel = “models/weapons/w_axe.mdl”

function SWEP:Initialize()

    self:SetWeaponHoldType( "melee2" )

end

function SWEP:PrimaryAttack()

    self.Weapon:SetNextPrimaryFire( CurTime() + 0.43 )
   
    local trace = self.Owner:GetEyeTrace();
    if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 75 then
                    self.Owner:SetAnimation( PLAYER_ATTACK1 );
                    self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER );
                            bullet = {}
                            bullet.Num    = 1
                            bullet.Src    = self.Owner:GetShootPos()
                            bullet.Dir    = self.Owner:GetAimVector()
                            bullet.Spread = Vector(0, 0, 0)
                            bullet.Tracer = 0
                            bullet.Force  = 1
                            bullet.Damage = 25		
                    self.Owner:FireBullets(bullet)
					if trace.HitNonWorld then
                    self.Weapon:EmitSound("weapons/knife/knife_slash1.wav") 
					else
					self.Weapon:EmitSound("weapons/knife/knife_slash2.wav") 
					end		
    else
            self.Owner:SetAnimation( PLAYER_ATTACK1 );
            self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER );
            self.Weapon:EmitSound("weapons/knife/knife_slash1.wav")  
    end

end

function SWEP:SecondaryAttack()

return false

end
[/lua]

Any help would be appreciated, thank you.

I’d suggest taking a look at the default weapon_fists file.

Ok, thanks.