Im searching for a hook/function/anything to look if an Entity is killed or a player killsed a specific Entity.
if its a self coded entity you can set a variable on it like ENT.Killed = True.
First i try with a normal Zombie from Gmod
function NPCKillCounter( npc, killer, weapon ) if not killer:IsPlayer() then return end if killer.KillCount then -- Check if the KillCount variable exists killer.KillCount = killer.KillCount + 1 -- If the variable exists then increase its value by 1 elseif killer.KillCount == 2 then chat.AddText("Holy shit! " .. Player:GetName() .. " Is killing NPCs") -- Prints in chat, Holy shit (player) is killing npcs else killer.KillCount = 1 -- If the variable doesn't exist then set it to 1 end end hook.Add( "OnNPCKilled", "NPCKillCounter", NPCKillCounter )
There, is the best I could do!
Exact code, works for me!
Enjoy, ~ Jacob
( Give me the rates, for free ~ )