Hit 25 Damage Every swing

I have a custom melee swep and it seems every time I hit a bot/player it doesn’t do 25 damage (which is set in the SWEP shared.lua file as: SWEP.Primary.Damage=25).

I want it exactly like the crowbar to where every single time I swing the weapon it will do a constant 25 damage.

Im not sure how to do this, but here is the SWEPs shared file.

[lua]

if ( SERVER ) then

AddCSLuaFile( "shared.lua" )

SWEP.HoldType			= "crowbar"

end

if ( CLIENT ) then

SWEP.Slot				= 1
SWEP.SlotPos			= 7
SWEP.ViewModelFOV		= 80
SWEP.IconLetter			= "x"
SWEP.Category = "Medieval Roleplay"

end

– function SWEP:Reload() --To do when reloading
– end

function SWEP:Think() – Called every frame
end

function SWEP:Initialize()
util.PrecacheSound("")
end

function SWEP:PrimaryAttack()
self.Weapon:SetNextPrimaryFire(CurTime() + .4)

local trace = self.Owner:GetEyeTrace()

if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 75 then
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)
self.Weapon:EmitSound("")
else
self.Weapon:EmitSound("" … math.random( 1, 4 ) … “.wav”)
self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER)
end

end

function SWEP:Deploy()
return true;
end

function SWEP:Holster()
return true;
end

SWEP.ViewModel = “models/weapons/v_fryingpan/v_fryingpan.mdl”
SWEP.WorldModel = “models/weapons/w_fryingpan.mdl”

SWEP.Primary.Delay = 6
SWEP.Primary.Recoil = 0
SWEP.Primary.Damage = 25
SWEP.Primary.NumShots = 1
SWEP.Primary.Cone = 0
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = “none”

SWEP.Secondary.Delay = 1000
SWEP.Secondary.Recoil = 0
SWEP.Secondary.Damage = 25
SWEP.Secondary.NumShots = 1
SWEP.Secondary.Cone = 0
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = “none”

[/lua]

Don’t shoot bullets. There are multiple other functions for that.

[editline]30th January 2014[/editline]

See my fists SWEP in lua/weapons/



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) 


that is dependant on the hitgroup of whatever part of the player you hit…

use



if IsValid(trace.Entity) and (trace.Entity:IsPlayer() or trace.Entity:IsNPC()) then
trace.Entity:TakeDamage(25, self.Owner, self)
end


in it’s place, as a better alternative