Fist SWEP for TTT having issues

Bobblehead recently just created a fist swep for TTT for me but it has an issue where the fists don’t do any damage at all and causes no damage to windows,boxes, etc. No errors are shown when using it. Any clue?


if (SERVER) then
        AddCSLuaFile( "shared.lua" )
        resource.AddFile("materials/vgui/entities/fists_weapon.vtf")
        resource.AddFile("materials/vgui/entities/fists_weapon.vmt")
        resource.AddFile("models/weapons/v_fists_t.dx80.vtx")
        resource.AddFile("models/weapons/v_fists_t.dx90.vtx")
        resource.AddFile("models/weapons/v_fists_t.mdl")
        resource.AddFile("models/weapons/v_fists_t.sw.vtx")
        resource.AddFile("models/weapons/v_fists_t.vvd")
        resource.AddFile("models/weapons/v_fists_tt.dx90.vtx")
        resource.AddFile("models/weapons/w_fists_t.dx80.vtx")
        resource.AddFile("models/weapons/w_fists_t.dx90.vtx")
        resource.AddFile("models/weapons/w_fists_t.mdl")
        resource.AddFile("models/weapons/w_fists_t.phy")
        resource.AddFile("models/weapons/w_fists_t.sw.vtx")
        resource.AddFile("models/weapons/w_fists_t.vvd")
        resource.AddFile("sound/weapons/Fist1.wav")
        resource.AddFile("sound/weapons/Fist2.wav")
        resource.AddFile("sound/weapons/Fist3.wav")
        resource.AddFile("sound/weapons/Fist4.wav")
        resource.AddFile("sound/weapons/Fistwall1.wav")
        resource.AddFile("sound/weapons/Fistmiss1.wav")
        resource.AddFile("sound/weapons/Fistmiss2.wav")
 
end
 
if CLIENT then
   SWEP.PrintName                       = "Fists"
 
   SWEP.Slot                            = 0
 
   SWEP.Icon = "VGUI/ttt/icon_fists"  
   SWEP.ViewModelFOV = 64
end
 
SWEP.Base                               = "weapon_tttbase"
SWEP.Spawnable                  = false
SWEP.AdminSpawnable             = true
 
SWEP.DrawCrosshair      = false
SWEP.DrawAmmo           = false
 
SWEP.ViewModel                  = "models/weapons/v_fists_t.mdl"
SWEP.WorldModel                 = "models/weapons/w_fists_t.mdl"
SWEP.Weight                     = 5
SWEP.DrawCrosshair              = false
SWEP.ViewModelFlip              = false
SWEP.Primary.Damage = 20
SWEP.Primary.ClipSize           = -1
SWEP.Primary.DefaultClip        = -1
SWEP.Primary.Automatic          = true
SWEP.Primary.Delay = 0.5
SWEP.Primary.Ammo               = "none"
SWEP.Primary.Automatic  = true
SWEP.Primary.Damage             = 25
SWEP.Primary.Delay              = 0.5
 
SWEP.Secondary.ClipSize         = -1
SWEP.Secondary.DefaultClip      = -1
SWEP.Secondary.Automatic        = true
SWEP.Secondary.Ammo             = "none"
SWEP.Secondary.Delay = 5
 
SWEP.Kind = WEAPON_MELEE
SWEP.WeaponID = AMMO_CROWBAR
 
SWEP.InLoadoutFor = {ROLE_INNOCENT, ROLE_TRAITOR, ROLE_DETECTIVE}
 
SWEP.NoSights = true
SWEP.IsSilent = true
 
SWEP.AutoSpawnable = false
 
SWEP.AllowDelete = false -- never removed for weapon reduction
SWEP.AllowDrop = false
-- only open things that have a name (and are therefore likely to be meant to
-- open) and are the right class. Opening behaviour also differs per class, so
-- return one of the OPEN_ values
local function OpenableEnt(ent)
   local cls = ent:GetClass()
   if ent:GetName() == "" then
      return OPEN_NO
   elseif cls == "prop_door_rotating" then
      return OPEN_ROT
   elseif cls == "func_door" or cls == "func_door_rotating" then
      return OPEN_DOOR
   elseif cls == "func_button" then
      return OPEN_BUT
   elseif cls == "func_movelinear" then
      return OPEN_NOTOGGLE
   else
      return OPEN_NO
   end
end
 
 
SWEP.FistHit                    =       "weapons/Fistwall1.wav"
SWEP.FistHitFlesh               = {     "weapons/Fist1.wav",
                                                        "weapons/Fist2.wav",
                                                        "weapons/Fist3.wav",
                                                        "weapons/Fist4.wav" }
SWEP.FistMiss                   = {     "weapons/Fistmiss1.wav",
                                                        "weapons/Fistmiss2.wav" }
 
SWEP.HoldType = "fist"
SWEP.ViewPunch                  = Angle( 0, 0, 0 )
SWEP.Enabled = true
 
SWEP.AnimDeploy         = nil
 
function SWEP:Initialize()
 
        self:SetWeaponHoldType( self.HoldType )
       
end
 
function SWEP:Precache()
 
        util.PrecacheSound("weapons/Fist1.wav")
        util.PrecacheSound("weapons/Fist2.wav")
        util.PrecacheSound("weapons/Fist3.wav")
        util.PrecacheSound("weapons/Fist4.wav")
        util.PrecacheSound("weapons/Fistwall1.wav")
        util.PrecacheSound("weapons/Fistmiss1.wav")
        util.PrecacheSound("weapons/Fistmiss2.wav")
 
end
 
-- only open things that have a name (and are therefore likely to be meant to
-- open) and are the right class. Opening behaviour also differs per class, so
-- return one of the OPEN_ values
local function OpenEnt(ent)
   local cls = ent:GetClass()
   if ent:GetName() == "" then
      return OPEN_NO
   elseif cls == "prop_door_rotating" then
      return OPEN_ROT
   elseif cls == "func_door" or cls == "func_door_rotating" then
      return OPEN_DOOR
   elseif cls == "func_button" then
      return OPEN_BUT
   elseif cls == "func_movelinear" then
      return OPEN_NOTOGGLE
   else
      return OPEN_NO
   end
end
 
 
local function CrowbarCanUnlock(t)
   return not GAMEMODE.crowbar_unlocks or GAMEMODE.crowbar_unlocks[t]
end
 
-- will open door AND return what it did
function SWEP:OpenEnt(hitEnt)
   -- Get ready for some prototype-quality code, all ye who read this
   if SERVER and GetConVar("ttt_crowbar_unlocks"):GetBool() then
      local openable = OpenableEnt(hitEnt)
 
      if openable == OPEN_DOOR or openable == OPEN_ROT then
         local unlock = CrowbarCanUnlock(openable)
         if unlock then
            hitEnt:Fire("Unlock", nil, 0)
         end
 
         if unlock or hitEnt:HasSpawnFlags(256) then
            if openable == OPEN_ROT then
               hitEnt:Fire("OpenAwayFrom", self.Owner, 0)
            end
            hitEnt:Fire("Toggle", nil, 0)
         else
            return OPEN_NO
         end
      elseif openable == OPEN_BUT then
         if CrowbarCanUnlock(openable) then
            hitEnt:Fire("Unlock", nil, 0)
            hitEnt:Fire("Press", nil, 0)
         else
            return OPEN_NO
         end
      elseif openable == OPEN_NOTOGGLE then
         if CrowbarCanUnlock(openable) then
            hitEnt:Fire("Open", nil, 0)
         else
            return OPEN_NO
         end
      end
      return openable
   else
      return OPEN_NO
   end
end
 
function SWEP:PrimaryAttack()
   self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
        local sound
   if not IsValid(self.Owner) then return end
 
   if self.Owner.LagCompensation then -- for some reason not always true
      self.Owner:LagCompensation(true)
   end
 
   local spos = self.Owner:GetShootPos()
   local sdest = spos + (self.Owner:GetAimVector() * 70)
 
   local tr_main = util.TraceLine({start=spos, endpos=sdest, filter=self.Owner, mask=MASK_SHOT_HULL})
   local hitEnt = tr_main.Entity
 
   if IsValid(hitEnt) or tr_main.HitWorld then
      self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
 
      if not (CLIENT and (not IsFirstTimePredicted())) then
         local edata = EffectData()
         edata:SetStart(spos)
         edata:SetOrigin(tr_main.HitPos)
         edata:SetNormal(tr_main.Normal)
 
         --edata:SetSurfaceProp(tr_main.MatType)
         --edata:SetDamageType(DMG_CLUB)
         edata:SetEntity(hitEnt)
 
         if hitEnt:IsPlayer() or hitEnt:GetClass() == "prop_ragdoll" then
            util.Effect("BloodImpact", edata)
 
            -- does not work on players rah
            --util.Decal("Blood", tr_main.HitPos + tr_main.HitNormal, tr_main.HitPos - tr_main.HitNormal)
 
            -- do a bullet just to make blood decals work sanely
            -- need to disable lagcomp because firebullets does its own
            self.Owner:LagCompensation(false)
            self.Owner:FireBullets({Num=1, Src=spos, Dir=self.Owner:GetAimVector(), Spread=Vector(0,0,0), Tracer=0, Force=1, Damage=0})
         else
            util.Effect("Impact", edata)
         end
      end
   else
      self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER )
          sound = self.FistMiss
   end
       
        if SERVER then
                if IsValid(hitEnt) && ( hitEnt:IsPlayer() || hitEnt:IsNPC() ) then
                                sound = self.FistHitFlesh
                else
                                sound = self.FistHit
                end
                if sound && IsFirstTimePredicted() then
                                if type(sound) == "table" then
                                                self.Weapon:EmitSound( sound[math.random(1, #sound)] )
                                else
                                                self.Weapon:EmitSound( sound )
                                end
                end
        end
 
   if CLIENT then
      -- used to be some shit here
   else -- SERVER
 
      -- Do another trace that sees nodraw stuff like func_button
      local tr_all = nil
      tr_all = util.TraceLine({start=spos, endpos=sdest, filter=self.Owner})
     
      self.Owner:SetAnimation( PLAYER_ATTACK1 )
 
      if hitEnt and hitEnt:IsValid() then
         if self:OpenEnt(hitEnt) == OPEN_NO and tr_all.Entity and tr_all.Entity:IsValid() then
            -- See if there's a nodraw thing we should open
            self:OpenEnt(tr_all.Entity)
         end
 
         local dmg = DamageInfo()
         dmg:SetDamage(self.Primary.Damage)
         dmg:SetAttacker(self.Owner)
         dmg:SetInflictor(self.Weapon)
         dmg:SetDamageForce(self.Owner:GetAimVector() * 1500)
         dmg:SetDamagePosition(self.Owner:GetPos())
         dmg:SetDamageType(DMG_CLUB)
 
         hitEnt:DispatchTraceAttack(dmg, spos + (self.Owner:GetAimVector() * 3), sdest)
 
--         self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )        
 
--         self.Owner:TraceHullAttack(spos, sdest, Vector(-16,-16,-16), Vector(16,16,16), 30, DMG_CLUB, 11, true)
--         self.Owner:FireBullets({Num=1, Src=spos, Dir=self.Owner:GetAimVector(), Spread=Vector(0,0,0), Tracer=0, Force=1, Damage=20})
     
      else
--         if tr_main.HitWorld then
--            self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
--         else
--            self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER )
--         end
 
         -- See if our nodraw trace got the goods
         if tr_all.Entity and tr_all.Entity:IsValid() then
            self:OpenEnt(tr_all.Entity)
         end
      end
   end
 
   if self.Owner.LagCompensation then
      self.Owner:LagCompensation(false)
   end
end
 
function SWEP:SecondaryAttack()
   self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
   self.Weapon:SetNextSecondaryFire( CurTime() + 0.1 )
 
   local tr = self.Owner:GetEyeTrace(MASK_SHOT)
 
   if tr.Hit and IsValid(tr.Entity) and tr.Entity:IsPlayer() and (self.Owner:EyePos() - tr.HitPos):Length() < 100 then
      local ply = tr.Entity
 
      if SERVER and (not ply:IsFrozen()) then
         local pushvel = tr.Normal * GetConVar("ttt_crowbar_pushforce"):GetFloat()
 
         -- limit the upward force to prevent launching
         pushvel.z = math.Clamp(pushvel.z, 50, 100)
 
         ply:SetVelocity(ply:GetVelocity() + pushvel)
         self.Owner:SetAnimation( PLAYER_ATTACK1 )
 
         ply.was_pushed = {att=self.Owner, t=CurTime()} --, infl=self}
      end
      
      self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
 
      self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )
   end
end

Change the:


IF SERVER then
if IsValid(hitent) && ( hitEnt:IsPlayer()||hitEnt:IsNPC()) then
sound = self.FistHitFlesh
else
sound = self.FistHit


to


if IsValid(Trace.Entity) && ( Trace.Entity:IsPlayer()||Trace.Entity:IsNPC()) then
sound = self.FistHitFlesh
--This new code actually hurts the entity, as the other code doesn't seem to work.
trace.Entity:TakeDamage( self.Primary.Damage, self.Owner )
else
sound = self.FistHit

Try this.

Thanks for the reply. Now it spams this error through the console and it still doesn’t do damage or break props.

Lua Error: [ERROR] gamemodes/terrortown/entities/weapons/weapon_zm_improvised/shared.lua:242: attempt to index global ‘Trace’ (a nil value) 1. oldprimary - gamemodes/terrortown/entities/weapons/weapon_zm_improvised/shared.lua:242 2. unknown - lua/sv_events.lua:119Lua Error: [ERROR] gamemodes/terrortown/entities/weapons/weapon_zm_improvised/shared.lua:242: attempt to index global ‘Trace’ (a nil value) 1. oldprimary - gamemodes/terrortown/entities/weapons/weapon_zm_improvised/shared.lua:242 2. unknown - lua/sv_events.lua:119

Apologies.


function SWEP:Punch( dmg, hitworld_sound, hitply_sound, miss_sound )

	local trace = util.TraceHull({start=self.Owner:GetShootPos(),
			endpos=self.Owner:GetShootPos() + self.Owner:GetAimVector() * 50,
			mins=Vector(-8, -8, -8), maxs=Vector(8, 8, 8),
			filter=self.Owner})

	local sound = miss_sound
	if trace.Hit then
		if IsValid(trace.Entity) && ( trace.Entity:IsPlayer() || trace.Entity:IsNPC() ) then
			sound = hitply_sound
		else
			sound = hitworld_sound
		end
	end

	if sound && IsFirstTimePredicted() then
		if type(sound) == "table" then
			self.Weapon:EmitSound( sound[math.random(1, #sound)] )
		else
			self.Weapon:EmitSound( sound )
		end
	end

	self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
	self.Owner:SetAnimation( PLAYER_ATTACK1 )
	self.Owner:ViewPunch( self.ViewPunch )

	if SERVER && IsValid( trace.Entity ) then
		if ( trace.Entity:IsPlayer() || trace.Entity:IsNPC() ) then
	
			trace.Entity:TakeDamage( self.Primary.Damage, self.Owner )
			trace.Entity:SetVelocity( self.Owner:GetAimVector() * 512, 0 )
			
		else
			local phys = trace.Entity:GetPhysicsObject()
			if IsValid(phys) then
				phys:SetVelocity( self.Owner:GetVelocity() + (self.Owner:GetAimVector() * 512) )
			end
		end			

	end
end

function SWEP:PrimaryAttack()

	if !self:CanPrimaryAttack() then return end
	self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )

	self:Punch( self.Primary.Damage, self.FistHit, self.FistHitFlesh, self.FistMiss )

end

Try that.

Why don’t you just use the fists SWEP that comes with Garry’s Mod?

Any idea where to implant this code in the SWEP? Also I was wondering about that but had no clue where to start.

EDIT: I put the code like this

However it makes a clicking noise when trying to “fire” and it does no animation of “hitting”

I will continue to find a solution and will post back here when I am done.

Although Maybe you should try contacting the initial developer of the SWep(Bobblehead) to help you resolve the issue.

Thanks. I will try to contact Bobblehead for any information.

Alright. Sorry it took me so long. I’ve started a little TTT server and wrote a little script for a zombie to spawn to test damage on. This code should work. If you could put me in credits for the swep aswell, it would be great, but you don’t have to. :slight_smile:


if (SERVER) then
        AddCSLuaFile( "shared.lua" )
        resource.AddFile("materials/vgui/entities/fists_weapon.vtf")
        resource.AddFile("materials/vgui/entities/fists_weapon.vmt")
        resource.AddFile("models/weapons/v_fists_t.dx80.vtx")
        resource.AddFile("models/weapons/v_fists_t.dx90.vtx")
        resource.AddFile("models/weapons/v_fists_t.mdl")
        resource.AddFile("models/weapons/v_fists_t.sw.vtx")
        resource.AddFile("models/weapons/v_fists_t.vvd")
        resource.AddFile("models/weapons/v_fists_tt.dx90.vtx")
        resource.AddFile("models/weapons/w_fists_t.dx80.vtx")
        resource.AddFile("models/weapons/w_fists_t.dx90.vtx")
        resource.AddFile("models/weapons/w_fists_t.mdl")
        resource.AddFile("models/weapons/w_fists_t.phy")
        resource.AddFile("models/weapons/w_fists_t.sw.vtx")
        resource.AddFile("models/weapons/w_fists_t.vvd")
        resource.AddFile("sound/weapons/Fist1.wav")
        resource.AddFile("sound/weapons/Fist2.wav")
        resource.AddFile("sound/weapons/Fist3.wav")
        resource.AddFile("sound/weapons/Fist4.wav")
        resource.AddFile("sound/weapons/Fistwall1.wav")
        resource.AddFile("sound/weapons/Fistmiss1.wav")
        resource.AddFile("sound/weapons/Fistmiss2.wav")
 
end
 
if CLIENT then
   SWEP.PrintName                       = "Fists"
 
   SWEP.Slot                            = 0
 
   SWEP.Icon = "VGUI/ttt/icon_fists"  
   SWEP.ViewModelFOV = 64
end
 
SWEP.Base                               = "weapon_tttbase"
SWEP.Spawnable                  = false
SWEP.AdminSpawnable             = true
 
SWEP.DrawCrosshair      = false
SWEP.DrawAmmo           = false
 
SWEP.ViewModel                  = "models/weapons/v_fists_t.mdl"
SWEP.WorldModel                 = "models/weapons/w_fists_t.mdl"
SWEP.Weight                     = 5
SWEP.DrawCrosshair              = false
SWEP.ViewModelFlip              = false
SWEP.Primary.Damage = 20
SWEP.Primary.ClipSize           = -1
SWEP.Primary.DefaultClip        = -1
SWEP.Primary.Automatic          = true
SWEP.Primary.Delay = 0.5
SWEP.Primary.Ammo               = "none"
SWEP.Primary.Automatic  = true
SWEP.Primary.Damage             = 25
SWEP.Primary.Delay              = 0.5
 
SWEP.Secondary.ClipSize         = -1
SWEP.Secondary.DefaultClip      = -1
SWEP.Secondary.Automatic        = true
SWEP.Secondary.Ammo             = "none"
SWEP.Secondary.Delay = 5
 
SWEP.Kind = WEAPON_MELEE
SWEP.WeaponID = AMMO_CROWBAR
 
SWEP.InLoadoutFor = {ROLE_INNOCENT, ROLE_TRAITOR, ROLE_DETECTIVE}
 
SWEP.NoSights = true
SWEP.IsSilent = true
 
SWEP.AutoSpawnable = false
 
SWEP.AllowDelete = false -- never removed for weapon reduction
SWEP.AllowDrop = false
-- only open things that have a name (and are therefore likely to be meant to
-- open) and are the right class. Opening behaviour also differs per class, so
-- return one of the OPEN_ values
local function OpenableEnt(ent)
   local cls = ent:GetClass()
   if ent:GetName() == "" then
      return OPEN_NO
   elseif cls == "prop_door_rotating" then
      return OPEN_ROT
   elseif cls == "func_door" or cls == "func_door_rotating" then
      return OPEN_DOOR
   elseif cls == "func_button" then
      return OPEN_BUT
   elseif cls == "func_movelinear" then
      return OPEN_NOTOGGLE
   else
      return OPEN_NO
   end
end
 
 
SWEP.FistHit                    =       "weapons/Fistwall1.wav"
SWEP.FistHitFlesh               = {     "weapons/Fist1.wav",
                                                        "weapons/Fist2.wav",
                                                        "weapons/Fist3.wav",
                                                        "weapons/Fist4.wav" }
SWEP.FistMiss                   = {     "weapons/Fistmiss1.wav",
                                                        "weapons/Fistmiss2.wav" }
 
SWEP.HoldType = "fist"
SWEP.ViewPunch                  = Angle( 0, 0, 0 )
SWEP.Enabled = true
 
SWEP.AnimDeploy         = nil
 
function SWEP:Initialize()
 
        self:SetWeaponHoldType( self.HoldType )
       
end
 
function SWEP:Precache()
 
        util.PrecacheSound("weapons/Fist1.wav")
        util.PrecacheSound("weapons/Fist2.wav")
        util.PrecacheSound("weapons/Fist3.wav")
        util.PrecacheSound("weapons/Fist4.wav")
        util.PrecacheSound("weapons/Fistwall1.wav")
        util.PrecacheSound("weapons/Fistmiss1.wav")
        util.PrecacheSound("weapons/Fistmiss2.wav")
 
end
 
-- only open things that have a name (and are therefore likely to be meant to
-- open) and are the right class. Opening behaviour also differs per class, so
-- return one of the OPEN_ values
local function OpenEnt(ent)
   local cls = ent:GetClass()
   if ent:GetName() == "" then
      return OPEN_NO
   elseif cls == "prop_door_rotating" then
      return OPEN_ROT
   elseif cls == "func_door" or cls == "func_door_rotating" then
      return OPEN_DOOR
   elseif cls == "func_button" then
      return OPEN_BUT
   elseif cls == "func_movelinear" then
      return OPEN_NOTOGGLE
   else
      return OPEN_NO
   end
end
 
 
local function CrowbarCanUnlock(t)
   return not GAMEMODE.crowbar_unlocks or GAMEMODE.crowbar_unlocks[t]
end
 
-- will open door AND return what it did
function SWEP:OpenEnt(hitEnt)
   -- Get ready for some prototype-quality code, all ye who read this
   if SERVER and GetConVar("ttt_crowbar_unlocks"):GetBool() then
      local openable = OpenableEnt(hitEnt)
 
      if openable == OPEN_DOOR or openable == OPEN_ROT then
         local unlock = CrowbarCanUnlock(openable)
         if unlock then
            hitEnt:Fire("Unlock", nil, 0)
         end
 
         if unlock or hitEnt:HasSpawnFlags(256) then
            if openable == OPEN_ROT then
               hitEnt:Fire("OpenAwayFrom", self.Owner, 0)
            end
            hitEnt:Fire("Toggle", nil, 0)
         else
            return OPEN_NO
         end
      elseif openable == OPEN_BUT then
         if CrowbarCanUnlock(openable) then
            hitEnt:Fire("Unlock", nil, 0)
            hitEnt:Fire("Press", nil, 0)
         else
            return OPEN_NO
         end
      elseif openable == OPEN_NOTOGGLE then
         if CrowbarCanUnlock(openable) then
            hitEnt:Fire("Open", nil, 0)
         else
            return OPEN_NO
         end
      end
      return openable
   else
      return OPEN_NO
   end
end
 
function SWEP:PrimaryAttack()
   self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
        local sound
   if not IsValid(self.Owner) then return end
 
   if self.Owner.LagCompensation then -- for some reason not always true
      self.Owner:LagCompensation(true)
   end
 
   local spos = self.Owner:GetShootPos()
   local sdest = spos + (self.Owner:GetAimVector() * 70)
 
   local tr_main = util.TraceLine({start=spos, endpos=sdest, filter=self.Owner, mask=MASK_SHOT_HULL})
   local hitEnt = tr_main.Entity
   self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
   self.Owner:SetAnimation( PLAYER_ATTACK1 )
   if IsValid(hitEnt) or tr_main.HitWorld then
      
 
      if not (CLIENT and (not IsFirstTimePredicted())) then
         local edata = EffectData()
         edata:SetStart(spos)
         edata:SetOrigin(tr_main.HitPos)
         edata:SetNormal(tr_main.Normal)
 
         --edata:SetSurfaceProp(tr_main.MatType)
         --edata:SetDamageType(DMG_CLUB)
         edata:SetEntity(hitEnt)
 
         if hitEnt:IsPlayer() or hitEnt:GetClass() == "prop_ragdoll" then
            util.Effect("BloodImpact", edata)
 
            -- does not work on players rah
            --util.Decal("Blood", tr_main.HitPos + tr_main.HitNormal, tr_main.HitPos - tr_main.HitNormal)
 
            -- do a bullet just to make blood decals work sanely
            -- need to disable lagcomp because firebullets does its own
            self.Owner:LagCompensation(false)
            self.Owner:FireBullets({Num=1, Src=spos, Dir=self.Owner:GetAimVector(), Spread=Vector(0,0,0), Tracer=0, Force=1, Damage=0})
         else
            util.Effect("Impact", edata)
         end
      end
   else
      self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER )
          sound = self.FistMiss
   end
       
        if SERVER then
                if IsValid(hitEnt) && ( hitEnt:IsPlayer() || hitEnt:IsNPC() ) then
                                sound = self.FistHitFlesh
								local trace = util.TraceHull({start=self.Owner:GetShootPos(),
								endpos=self.Owner:GetShootPos() + self.Owner:GetAimVector() * 50,
								mins=Vector(-8, -8, -8), maxs=Vector(8, 8, 8),
								filter=self.Owner})
								trace.Entity:TakeDamage( self.Primary.Damage, self.Owner )
                else
                                sound = self.FistHit
                end
                if sound && IsFirstTimePredicted() then
                                if type(sound) == "table" then
                                                self.Weapon:EmitSound( sound[math.random(1, #sound)] )
                                else
                                                self.Weapon:EmitSound( sound )
                                end
                end
        end
 
   if CLIENT then
      -- used to be some shit here
   else -- SERVER
 
      -- Do another trace that sees nodraw stuff like func_button
      local tr_all = nil
      tr_all = util.TraceLine({start=spos, endpos=sdest, filter=self.Owner})
      self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER)
      self.Owner:SetAnimation( PLAYER_ATTACK1 )
 
      if hitEnt and hitEnt:IsValid() then
         if self:OpenEnt(hitEnt) == OPEN_NO and tr_all.Entity and tr_all.Entity:IsValid() then
            -- See if there's a nodraw thing we should open
            self:OpenEnt(tr_all.Entity)
         end
 
         local dmg = DamageInfo()
         dmg:SetDamage(self.Primary.Damage)
         dmg:SetAttacker(self.Owner)
         dmg:SetInflictor(self.Weapon)
         dmg:SetDamageForce(self.Owner:GetAimVector() * 1500)
         dmg:SetDamagePosition(self.Owner:GetPos())
         dmg:SetDamageType(DMG_CLUB)
 
         hitEnt:DispatchTraceAttack(dmg, spos + (self.Owner:GetAimVector() * 3), sdest)
 
--         self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )        
 
--         self.Owner:TraceHullAttack(spos, sdest, Vector(-16,-16,-16), Vector(16,16,16), 30, DMG_CLUB, 11, true)
--         self.Owner:FireBullets({Num=1, Src=spos, Dir=self.Owner:GetAimVector(), Spread=Vector(0,0,0), Tracer=0, Force=1, Damage=20})
     
      else
--         if tr_main.HitWorld then
--            self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
--         else
--            self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER )
--         end
 
         -- See if our nodraw trace got the goods
         if tr_all.Entity and tr_all.Entity:IsValid() then
            self:OpenEnt(tr_all.Entity)
         end
      end
   end
 
   if self.Owner.LagCompensation then
      self.Owner:LagCompensation(false)
   end
end
 
function SWEP:SecondaryAttack()
   self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
   self.Weapon:SetNextSecondaryFire( CurTime() + 0.1 )
 
   local tr = self.Owner:GetEyeTrace(MASK_SHOT)
 
   if tr.Hit and IsValid(tr.Entity) and tr.Entity:IsPlayer() and (self.Owner:EyePos() - tr.HitPos):Length() < 100 then
      local ply = tr.Entity
 
      if SERVER and (not ply:IsFrozen()) then
         local pushvel = tr.Normal * GetConVar("ttt_crowbar_pushforce"):GetFloat()
 
         -- limit the upward force to prevent launching
         pushvel.z = math.Clamp(pushvel.z, 50, 100)
 
         ply:SetVelocity(ply:GetVelocity() + pushvel)
         self.Owner:SetAnimation( PLAYER_ATTACK1 )
 
         ply.was_pushed = {att=self.Owner, t=CurTime()} --, infl=self}
      end
      
      self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
 
      self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )
   end
end

If your problem persists, please check if you have the models in your TTT content folder.
If you need more help, feel free to contact me:
Here
my email: steelsliver@live.com
or steam: http://steamcommunity.com/id/steelshrappy

Sweet! It works great now. Thanks for your help.