TakeDamage not works correctly if player is spectator

Hello everyone.
Is there any way to get some die player is in spectactors, (tranqualized by tazer) applying DamageInfo? I only through the ply:Kill () … hp even have to deduct because they do not remove.

P.S. Sorry for my English

Are you trying to damage a player who is tazed?

yep, my code looks like this:



function EntityTakeDamage( ent, info )
	local attacker = info:GetAttacker()
	local dmg = info:GetDamage()
	local gun = info:GetInflictor()
	local amount = info:GetDamage()

	if ent:GetClass()=="prop_ragdoll" and IsValid(attacker) and attacker:IsPlayer() then
		if !IsValid(ent.owner) or !ent.owner:Alive() then return end
			ent.owner:TakeDamageInfo( info )
			if ent.owner:Health()>amount then
			--ent.owner:TakeDamageInfo( info )
				ent.owner:SetHealth(ent.owner:Health()-amount)
			else
				ent:SetNWBool("sleep",false)
				ent.owner:SetNWBool("body_found", false)
				net.Start("cl_tazedoll")
					net.WriteBit(false)
				net.Broadcast()
				ent.owner:Kill()
			end
	end
end
hook.Add("EntityTakeDamage","EntityTakeDamage2",EntityTakeDamage)