local drawkilltime = 0
gameevent.Listen("entity_killed") --We want to listen to the event if any entities die.
hook.Add("entity_killed", "killmarker",function(data)
local victim = Entity(data.entindex_killed)
local attacker = Entity(data.entindex_attacker)
if !IsValid(victim) || !IsValid(attacker) then return end --Always check if they entities are there.
if attacker == LocalPlayer() && victim:IsPlayer() then
drawkilltime = CurTime()+1 --Draw the marker for 1 second
end
end)
hook.Add("HUDPaint", "DrawKillmarker",function())
if drawkilltime >= CurTime() then
--Draw killmarker here
end
end
sound.PlayFile("killmarker.wav", "mono", function()
surface.PlaySound("killmarker.wav")