What would cause all weapons to change DMG Type?

I recently installed M9K weapons, but only as skins in my PointShop. (Yeah, Pointshop) Lately players have pointed out that my leaderboards were no longer working so I checked the damage type and it turns out to be 8194 (DMG_ALWAYSGIB) when they were originally DMG_BULLET. What could cause the weapons to change damage type, even the stock/vanilla weapons?


Update: I’ll update my OP, but I installed a fresh new server, spawned bots, set up a hook on player death to print damagetype by the weapon, and I’m receiving 8194/4096 for stock/vanilla TTT weapons.


hook.Add("DoPlayerDeath", "Test", function(ply, killer, dmginfo)

killer:PrintMessage(3, dmginfo:GetDamageType())

end)

I’m not sure what else it could be other than Gmod or TTT possibly updating lately? The reason I say that was that it worked a week ago.

Maybe it does something on the EntityTakeDamage hook (search for it)

By searching for it, what exactly do you mean? Searching through files for EntityTakeDamage, or using the hook to see what happens when a player takes damage by one of the weapons?

The ID it returns from dmginfo:GetDamageType() is 8194. I misstook it for DMG_ALWAYSGIB which is 8192.

Search through your files for EntityTakeDamage.

Here’s every file I’ve found that has EntityTakeDamage.

TTTDamageLogs\lua\damagelog_events\damages.lua


function event:EntityTakeDamage(ent, dmginfo)

	local att = dmginfo:GetAttacker()
	if not (ent.IsGhost and ent:IsGhost()) and ent:IsPlayer() and (IsValid(att) and att:IsPlayer()) and ent != att then
		local damages = dmginfo:GetDamage()
		if math.floor(damages) > 0 then
			local tbl = { 
				[1] = ent:Nick(), 
				[2] = ent:GetRole(), 
				[3] = att:Nick(), 
				[4] = att:GetRole(), 
				[5] = math.Round(damages), 
				[6] = Damagelog:WeaponFromDmg(dmginfo), 
				[7] = ent:SteamID(), 
				[8] = att:SteamID() 
			}
			if Damagelog:IsTeamkill(tbl[2], tbl[4]) then
				tbl.icon = { "icon16/exclamation.png" }
			else
				local found_dmg = false
				for k,v in pairs(Damagelog.DamageTable) do
					if type(v) == "table" and Damagelog.events[v.id] and Damagelog.events[v.id].IsDamage then
						if v.time >= Damagelog.Time - 10 and v.time <= Damagelog.Time then
							found_dmg = true
							break
						end
					end
				end
				if not found_dmg then
					local first
					local shoots = {}
					for k,v in pairs(Damagelog.ShootTables[Damagelog.CurrentRound] or {}) do
						if k >= Damagelog.Time - 10 and k <= Damagelog.Time then
							shoots[k] = v
						end
					end	
					for k,v in pairs(shoots) do
						if not first or k < first  then
							first = k
						end
					end
					if shoots[first] then
						for k,v in pairs(shoots[first]) do
							if v[1] == ent:Nick() then
								tbl.icon = { "icon16/exclamation.png", "The victim may have shot first (see the damage information section for more info!)" }
							end
						end
					end
				end
			end
			self.CallEvent(tbl)
		end
	end
	
end

TTTDamageLogs\lua\damagelog_events\fall_damage.lua


function event:EntityTakeDamage(ent, dmginfo)
	local att = dmginfo:GetAttacker()
	if not (ent.IsGhost and ent:IsGhost()) and ent:IsPlayer() and att == game.GetWorld() and dmginfo:GetDamageType() == DMG_FALL then
		local damages = dmginfo:GetDamage()
		if math.floor(damages) > 0 then
			local tbl = { 
				[1] = ent:Nick(), 
				[2] = ent:GetRole(), 
				[3] = math.Round(damages), 
				[4] = ent:SteamID()
			}
			local push = ent.was_pushed
			if push and math.max(push.t or 0, push.hurt or 0) > CurTime() - 4 then
				tbl[5] = true
				tbl[6] = push.att:Nick()
				tbl[7] = push.att:GetRole()
				tbl[8] = push.att:SteamID()
				self.CallEvent(tbl)
			else
				local timername = "timerFallDamage_"..tostring(ent:UniqueID())
				if timer.Exists(timername) then
					if ent.FallDamageTable then
						ent.FallDamageTable[3] = math.Round(ent.FallDamageTable[3]+damages)
					end
				else
					timer.Create(timername, 0.1, 1, function()
						if IsValid(ent) and ent.FallDamageTable then
							self.CallEvent(ent.FallDamageTable, 6, 7)
						end
					end)
					tbl[5] = false
					tbl[6] = Damagelog.Time
					local index = Damagelog.DamageTable[1] == "empty" and #Damagelog.DamageTable or #Damagelog.DamageTable + 1
					tbl[7] = index
					Damagelog.DamageTable[index] = "ignore"
					ent.FallDamageTable = tbl
				end
			end
		end
	end
end

terrortown/gamemode/player.lua


function GM:EntityTakeDamage(ent, dmginfo)
   if not IsValid(ent) then return end
   local att = dmginfo:GetAttacker()

   if not GAMEMODE:AllowPVP() then
      -- if player vs player damage, or if damage versus a prop, then zero
      if (ent:IsExplosive() or (ent:IsPlayer() and IsValid(att) and att:IsPlayer())) then
         dmginfo:ScaleDamage(0)
         dmginfo:SetDamage(0)
      end
   elseif ent:IsPlayer() then

      GAMEMODE:PlayerTakeDamage(ent, dmginfo:GetInflictor(), att, dmginfo:GetDamage(), dmginfo)

   elseif ent:IsExplosive() then
      -- When a barrel hits a player, that player damages the barrel because
      -- Source physics. This gives stupid results like a player who gets hit
      -- with a barrel being blamed for killing himself or even his attacker.
      if IsValid(att) and att:IsPlayer() and
         dmginfo:IsDamageType(DMG_CRUSH) and
         IsValid(ent:GetPhysicsAttacker()) then

         dmginfo:SetAttacker(ent:GetPhysicsAttacker())
         dmginfo:ScaleDamage(0)
         dmginfo:SetDamage(0)
      end
   elseif ent.is_pinned and ent.OnPinnedDamage then
      ent:OnPinnedDamage(dmginfo)

      dmginfo:SetDamage(0)
   end
end

Update: I’m using a test server and I’m going to install a fresh new gmod server and try it again and see what happens.

Update2: Everything is vanilla, yet I’m still getting weird damage types. Is it possible a GMod/TTT update broke this?