Really weird issue

On TTT server we have SWEP Mellon launcher that launches melon prop. Problem is that when you kill 1 player on next player melon does 0 damage but hitmarker shows that it did 500dmg. I managed to detect addon that was causing launcher to break and exact part of code in that addon witch is breaking it and it’s weird and i cant understand why.

Launcher has pretty simple code:



if SERVER then
	AddCSLuaFile ()	
	resource.AddFile("materials/melon_gtx2ttt/weapon_melon_gtx2ttt.vmt")
	resource.AddFile("sound/melon_gtx2ttt/fart.wav")
	resource.AddFile("materials/melon_gtx2ttt/melon.png")

	SWEP.Weight = 5

	SWEP.AutoSwitchTo = false
	SWEP.AutoSwitchFrom = false
elseif CLIENT then
 
	SWEP.PrintName = "Melon Launcher"
	SWEP.Icon = "melon_gtx2ttt/weapon_melon_gtx2ttt"
	SWEP.EquipMenuData = {
      type = "item_weapon",
      desc = [[RPG that shot melons that will
insta kill on hit(5 charges).]]
	  };
	  
	SWEP.Slot = 6
    SWEP.DrawAmmo = true
    SWEP.DrawCrosshair = false
end
 
SWEP.Instructions = "An RPG that shoots melons. Primary fire: One shot."
SWEP.Base = "weapon_tttbase"
SWEP.HoldType = "rpg"
SWEP.ViewModelFlip = false
SWEP.ViewModelFOV 	= 56
function SWEP:Initialize()
	self:SetWeaponHoldType( self.HoldType )
end

SWEP.Base = "weapon_tttbase"

SWEP.Spawnable = true -- Whether regular players can see it
SWEP.AdminSpawnable = true -- Whether Admins/Super Admins can see it
 
SWEP.ViewModel = "models/weapons/v_RPG.mdl" -- This is the model used for clients to see in first person.
SWEP.WorldModel = "models/weapons/w_rocket_launcher.mdl" -- This is the model shown to all other clients and in third-person.
 
SWEP.Primary.ClipSize = 5
SWEP.Primary.DefaultClip = 5
SWEP.Primary.Automatic = false
SWEP.Primary.Delay = 3
SWEP.Primary.Ammo = "none"


SWEP.Secondary.ClipSize = 0
SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = true
SWEP.Secondary.Delay = 0
SWEP.Secondary.Ammo = "none"

SWEP.Kind = WEAPON_EQUIP1
SWEP.AutoSpawnable = false
SWEP.CanBuy = { ROLE_TRAITOR }
SWEP.InLoadoutFor = nil
SWEP.LimitedStock = true
SWEP.AllowDrop = true
SWEP.IsSilent = false
SWEP.NoSights = true
SWEP.IronSightsPos = Vector( 6.05, -5, 2.4 )
SWEP.IronSightsAng = Vector( 2.2, -0.1, 0 )
 

local ShootSound = Sound("melon_gtx2ttt/fart.wav")
 
function SWEP:Reload()
end
 
function SWEP:Think()
end
 
 
function SWEP:throw_attack (model_file)
	local tr = self.Owner:GetEyeTrace()
 
	self:EmitSound(ShootSound)
	self.BaseClass.ShootEffects(self)
 
	if (!SERVER) then return end
 
	local ent = ents.Create("prop_physics")
	ent:SetOwner(ply)
	ent:SetPhysicsAttacker(self.Owner)
	ent:SetModel(model_file)
 
	ent:SetPos(self.Owner:EyePos() + (self.Owner:GetAimVector() * 16))
	ent:SetAngles(self.Owner:EyeAngles())
	ent:Spawn()

	local phys = ent:GetPhysicsObject()
 
	if !(phys && IsValid(phys)) then ent:Remove() return end
 
	phys:ApplyForceCenter(self.Owner:GetAimVector():GetNormalized() *  math.pow(tr.HitPos:Length(), 3))
 
	//cleanup.Add(self.Owner, "props", ent)
	
	//undo.Create ("Thrown_SWEP_Entity")
		//undo.AddEntity (ent)
		//undo.SetPlayer (self.Owner)
	//undo.Finish()
end
 
function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end	
	self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
	self:TakePrimaryAmmo(1)
	self:throw_attack("models/props_junk/watermelon01.mdl")
end
 
function SWEP:SecondaryAttack()
end


Here is part of code from stats addon that is causing launcher issues:



local function DeathStat( victim, weapon, killer )
	if (killer.IsGhost and killer:IsGhost()) or (victim.IsGhost and victim:IsGhost()) then return end
	if GAMEMODE.round_state == ROUND_ACTIVE then
		if killer:IsValid() and killer.dbReady and killer.murders != nil then
			if killer:SteamID() != victim:SteamID() then
				if victim.lastHitGroup && victim.lastHitGroup == HITGROUP_HEAD then
					killer.headshots = killer.headshots + 1;
				end
				
				
				-- Bellow are 'rdm' kills.
				if killer:GetTraitor() == victim:GetTraitor() then
				
					if killer:GetTraitor() then
						killer.points = killer.points + T_Kill_T;
					elseif killer:GetDetective() and victim:GetDetective() then
						killer.points = killer.points + D_Kill_D;
					elseif killer:GetDetective() then
						killer.points = killer.points + D_Kill_Inno;
					elseif not (killer:GetTraitor() or killer:GetDetective()) and not (victim:GetTraitor() or victim:GetDetective()) then
						killer.points = killer.points + Inno_Kill_Inno;
					elseif not (killer:GetTraitor() or killer:GetDetective()) then
						killer.points = killer.points + Inno_Kill_D;
					end		

					
					killer.opKills = killer.opKills + 1;
				-- These are 'legitimate' kills
				else
					
					if killer:GetTraitor() and victim:GetDetective() then
						killer.points = killer.points + T_Kill_D;
						killer.dKilled = killer.dKilled + 1
						killer.tRound = killer.tRound + 1
					elseif killer:GetTraitor() then
						killer.points = killer.points + T_Kill_Inno;
						killer.iKilled = killer.iKilled + 1
						killer.tRound = killer.tRound + 1
					elseif killer:GetDetective() then
						killer.points = killer.points + D_Kill_T;
						killer.tKilled = killer.tKilled + 1
					elseif not (killer:GetTraitor() or killer:GetDetective()) then
						killer.points = killer.points + Inno_Kill_T;
						killer.tKilled = killer.tKilled + 1
					end	
				
					killer.murders = killer.murders + 1;
				end
			end
		end	
				
		if not victim.dbReady then return; end
		victim.deaths = victim.deaths + 1;
      // function causing issues ˇˇ
		savePlyStats(victim);
	end	
	
end

local function roundEnd(result)
	for _, ply in pairs(player.GetAll()) do
		if ply.dbReady then
			ply.totalkarma = ply.totalkarma + ply:GetBaseKarma()
			//try
			//ply.totalkarma = ply.totalkarma + ply:GetLiveKarma()
			if ply:Alive() then
				ply.points = ply.points + Surviving_the_Round; 
			else
				ply.points = ply.points + death; 
			end
			if ply:Frags() > ply.maxfrags or ply:Alive() then
            // function causing issues ˇˇ
				savePlyStats(ply);
			end
			if ply.tRound > ply.bestTround then
				ply.bestTround = ply.tRound
			end
		end
	end
end

function savePlyStats(ply)
	
	if table.HasValue( peopleToUpdate, ply ) then return; end
	table.insert( peopleToUpdate, ply);

end

function savePlyStatsSQL()
	if #peopleToUpdate == 0 then return; end

	if not ServerStatsDB.connected then return end
	ply = peopleToUpdate[1];
	table.remove(peopleToUpdate, 1)
	if IsValid(ply) then
		
		if ply.tRound > ply.bestTround then
			ply.bestTround = ply.tRound
		end
		if ply:Frags() > ply.maxfrags then
			ply.maxfrags = ply:Frags();
		end	
		if ply:IsSuperAdmin() then
			ply.isAdminz = 1
		else
			ply.isAdminz = 0
		end	
		ply.lastSeen = os.date("%d.%m.%Y. %X")
		updateString = "UPDATE ttt_stats SET nickname='%s', playtime='%d', roundsplayed='%d', innocenttimes='%d', detectivetimes='%d', traitortimes='%d', deaths='%d', kills='%d', maxfrags='%d', headshots='%d', karma='%d', traitorskilled='%d', detectiveskilled='%d', innokilled='%d', besttround='%d', last_seen='%s', isadmin='%d', points='%d', ignore_messages='%d' WHERE steamid ='%s'"		
		local EcName = db:escape( ply:Nick() );		
		local formQ = string.format(updateString,
						EcName,
						tonumber(getPlayTime(ply)),
						tonumber(ply.roundsplayed),
						tonumber(ply.timesInno),
						tonumber(ply.timesDetective),
						tonumber(ply.timesTraitor),
						tonumber(ply.deaths),
						tonumber(ply.murders),
						tonumber(ply.maxfrags),
						tonumber(ply.headshots),
						tonumber(ply.totalkarma),
						tonumber(ply.tKilled),
						tonumber(ply.dKilled),
						tonumber(ply.iKilled),
						tonumber(ply.bestTround),
						tostring(ply.lastSeen),
						tonumber(ply.isAdminz),
						tonumber(ply.points),
						tonumber(ply.ignore_messages),
						ply:SteamID()
					)
		
		local updateQuery = db:query(formQ)
		updateQuery.onSuccess = function(q) end; 
		updateQuery.onError = function(q,e)
			notifymessage("[Awesome Stats]Something went wrong")
			notifyerror(e)
		end
		updateQuery:start()	
	
	end
end
timer.Create("StatsUpdater", 5, 0, savePlyStatsSQL);

hook.Add( "PlayerDeath", "DeathState", DeathStat )
hook.Add( "TTTEndRound", "endsstats", roundEnd)



So when ever funciton savePlyStats is called in death hook or enoround launcher does no damage to players and when i comment out call of that function launcher works fine.
If someone could explain to me why this happens i would really appreciate it!