Printing :GetDamage() is getting smaller and smaller after damage

here is what I was printing



print(dmginfo:GetDamage() * 200)


It’s getting smaller and smaller… + it doesn’t multiply
also tried



print(dmginfo:GetBaseDamage() * 200)


bumperr

If you want it to multiply, you have to use

CTakeDamageInfo:ScaleDamage. I don’t know what you mean about it getting smaller each time though. It should stay relatively similar.

nonono I don’t want it to multiply but I think the damage is going down each time the person gets shot.

Do you have replicating code?

I don’t think so as I am printing ONLY it on the damage function (I see it only when I get hurt)

bump

There’s nothing to help with unless you have code that everyone can reproduce your issue with.



function GM:ScalePlayerDamage(ply, part, dmginfo)
	if ply.body_damage_parts then
		if part == HITGROUP_GENERIC then
			ply.body_damage_parts.head = ply.body_damage_parts.head - dmginfo:GetDamage() / 4
			if ply.body_damage_parts.head < 0 then
				ply.body_damage_parts.head = 0
			end
			ply.body_damage_parts.chest = ply.body_damage_parts.chest - dmginfo:GetDamage() / 4
			if ply.body_damage_parts.chest < 0 then
				ply.body_damage_parts.chest = 0
			end
			ply.body_damage_parts.stomach = ply.body_damage_parts.stomach - dmginfo:GetDamage() / 4
			if ply.body_damage_parts.stomach < 0 then
				ply.body_damage_parts.stomach = 0
			end
			ply.body_damage_parts.larm = ply.body_damage_parts.larm - dmginfo:GetDamage() / 4
			if ply.body_damage_parts.larm < 0 then
				ply.body_damage_parts.larm = 0
			end
			ply.body_damage_parts.rarm = ply.body_damage_parts.rarm - dmginfo:GetDamage() / 4
			if ply.body_damage_parts.rarm < 0 then
				ply.body_damage_parts.rarm = 0
			end
			ply.body_damage_parts.lleg = ply.body_damage_parts.lleg - dmginfo:GetDamage() / 4
			if ply.body_damage_parts.lleg < 0 then
				ply.body_damage_parts.lleg = 0
			end
			ply.body_damage_parts.rleg = ply.body_damage_parts.rleg - dmginfo:GetDamage() / 4
			if ply.body_damage_parts.rleg < 0 then
				ply.body_damage_parts.rleg = 0
			end
		elseif part == HITGROUP_HEAD then
			ply.body_damage_parts.head = ply.body_damage_parts.head - dmginfo:GetDamage()
			if ply.body_damage_parts.head < 0 then
				ply.body_damage_parts.head = 0
			end
		elseif part == HITGROUP_CHEST then
			ply.body_damage_parts.chest = ply.body_damage_parts.chest - dmginfo:GetDamage()
			if ply.body_damage_parts.chest < 0 then
				ply.body_damage_parts.chest = 0
			end
		elseif part == HITGROUP_STOMACH then
			ply.body_damage_parts.stomach = ply.body_damage_parts.stomach - dmginfo:GetDamage()
			if ply.body_damage_parts.stomach < 0 then
				ply.body_damage_parts.stomach = 0
			end
		elseif part == HITGROUP_LEFTARM then
			ply.body_damage_parts.larm = ply.body_damage_parts.larm - dmginfo:GetDamage()
			if ply.body_damage_parts.larm < 0 then
				ply.body_damage_parts.larm = 0
			end
		elseif part == HITGROUP_RIGHTARM then
			ply.body_damage_parts.rarm = ply.body_damage_parts.rarm - dmginfo:GetDamage()
			if ply.body_damage_parts.rarm < 0 then
				ply.body_damage_parts.rarm = 0
			end
		elseif part == HITGROUP_LEFTLEG then
			ply.body_damage_parts.lleg = ply.body_damage_parts.lleg - dmginfo:GetDamage()
			print(dmginfo:GetBaseDamage()() * 200)
			if ply.body_damage_parts.lleg < 0 then
				ply.body_damage_parts.lleg = 0
			end
		elseif part == HITGROUP_RIGHTLEG then
			ply.body_damage_parts.rleg = ply.body_damage_parts.rleg - dmginfo:GetDamage()
			print(dmginfo:GetBaseDamage() * 200)
			if ply.body_damage_parts.rleg < 0 then
				ply.body_damage_parts.rleg = 0
			end
		end
	end
end


Unrelated to your issue but you could benefit greatly from some heavy use of

math.max

That code shouldn’t even work.


dmginfo:GetBaseDamage()()

I would just map the enums to strings so that it reduces the excessive if-statements: that would fix the majority of the bulk.