• Entity Is Dead or Player Killed a specific Entity
    4 replies, posted
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
You could try checking if [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/Health]Entity:Health[/url] is 0 Also, [URL="https://facepunch.com/showthread.php?t=1164168"]this thread[/URL] might help
[CODE] 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 ) [/CODE] There, is the best I could do! Exact code, works for me! Enjoy, ~ Jacob ( Give me the rates, for free ~ )
Sorry, you need to Log In to post a reply to this thread.