Removing kills from body search.

Hello! I’ve been working on fixing/changing a TTT weapon called “Dead Ringer”. So far I managed to do a few changes I wanted to do, however i’ve been trying to remove the traitors kills from showing up when the traitor feigns death. Code below



function plymeta:fakedeath()

timer.Simple(0.1, function()
    if IsValid(self) then
      self.DringerSpeed = 1.5
       -- you have to call this function when you want to play the sound
       net.Start("FakePlayerDeathrun")
       net.Send(self) -- here has to go the player you want to hear that sound.
       -- and if you want all players to hear it use instead net.Broadcast()
    end
end)


timer.Simple(3.1, function()
    if IsValid(self) then
        self.DringerSpeed = 1
        -- you have to call this function when you want to play the sound
        net.Start("FakePlayerDeathwalk")
        net.Send(self) -- here has to go the player you want to hear that sound.
        -- and if you want all players to hear it use instead net.Broadcast()
    end
end)

self:SetNWBool("Dead", true)
self:SetNWBool("CanAttack", false)
self:SetNWBool("Status", 3)
self:SetColor(Color(255,255,255,0))
self:SetNoDraw(true)
self:SetNWBool("disguised", true)


---------------------------
--------"corpse"-------
---------------------------
-- this is time to make our corpse

	local weapons = {"weapon_zm_pistol","weapon_ttt_m16","weapon_zm_revolver","weapon_zm_shotgun","weapon_ttt_glock","weapon_zm_mac10","weapon_zm_revolver","weapon_zm_sledge"}

	local dmginfo = DamageInfo()  
	dmginfo:SetDamage( math.random(10,100) )
	dmginfo:SetDamageType( DMG_BULLET )

-- create the ragdoll
	local rag = ents.Create("prop_ragdoll", dmginfo)

	rag:SetPos(self:GetPos())
	rag:SetModel(self:GetModel())
	rag:SetAngles(self:GetAngles())
	rag:SetColor(self:GetColor())
	rag.SetOwner(self)
	self:SetCollisionGroup( COLLISION_GROUP_PASSABLE_DOOR )

	rag:Spawn(self)
	rag:Activate(self)

	-- flag this ragdoll as being a player's
	rag.player_ragdoll = self
	rag.uqid = self:UniqueID()
  
	self:SetNWBool("is_pretending", true)
	self:SetNWString("nick", self:Nick())

	-- network data
	CORPSE.SetPlayerNick(rag, self)
	CORPSE.SetCredits(rag, 0)

	-- if someone searches this body they can find info on the victim and the
	-- death circumstances
	rag.equipment = self:GetEquipmentItems()
 	rag.was_role = ROLE_INNOCENT
	rag.bomb_wire = false
	rag.dmgtype = ( DMG_BULLET )

	rag.dmgwep  = table.Random(weapons)

	rag.was_headshot = true
	rag.time = CurTime()
	rag.kills = table.Copy(self.kills)

	rag.killer_sample = nil

	-- position the bones
	local num = rag:GetPhysicsObjectCount()-1
	local v = self:GetVelocity()

	for i=0, num do
	local bone = rag:GetPhysicsObjectNum(i)
		
		if IsValid(bone) then
		local bp, ba = self:GetBonePosition(rag:TranslatePhysBoneToBone(i))
			if bp and ba then
				bone:SetPos(bp)
				bone:SetAngles(ba)
			end
		end
	end
end


Before you ask, yes I have tried the fallowing:

Removing this line: rag.kills = table.Copy(self.kills)

Changing that line to: rag.kills = nil

Lastly I tried this change: rag.kills = table.Copy()

Doing those changes made the search HUD not show up at all. (The screen that would show you the role, how they died, etc.) However the body would become identified.

Anyone know what would cause this issue? Thanks in advance.

Use:


rag.kills = {}

rag.kills must be a table.
The easiest way is setting it to a empty table.

Btw.:
I also tried to fix the dead ringer.
I quickly realized that fixing it is much more complex then completely recoding it. :stuck_out_tongue: