Claim credits when killing with fire?

Is there a way to get score if you kill someone by igniting them?

Seriously?! No one knows? Or everyone just dont wanna tell me? :frowning:

Give it a while. We aren’t some huge answer machine you put questions in and get a reply back from instantly.

[lua]local ignitors = {};

function _R.Player.IgniteByPlayer(duration, radius, ply)
ignitors[self] = ply;

timer.Simple(duration + 0.5, function()
	ignitors[self] = nil;

self:Ignite(duration, radius);


hook.Add(“EntityTakeDamage”, “IgniteByPlayer SetAttacker”, function(ent, inflictor, attacker, amount, dmginfo)
if(IsValid(ent) and ent:IsPlayer() and IsValid(attacker) and attacker:IsPlayer()
and dmginfo:GetDamageType() | DMG_BURN == DMG_BURN and ignitors[ent]) then

– Example on usage:
– ply:IgniteByPlayer(10, 0, attacker)[/lua]
Untested, but should work.

I’m not sure if this would work or not, but I think whenever you light someone on fire it creates an entityflame entity parented to that person. I bet if you did SetOwner on the entityflame ent, it would credit you with the kill.

Cant get it to work :frowning:

Hmm :confused: gonna try it out.

Oops. Replace “| DMG_BURN” with “& DMG_BURN”.

I don’t believe ent:Ignite() returns the entityflame object. The idea in the above method should work, but the damage type for a burning entity is actually DMG_DIRECT (DMG_BURN is damage from touching a burning entity). It may be better to check the inflictor’s class for “entityflame” in any case since anything that deals damage could potentially use the DMG_DIRECT damagetype and you could be changing to the wrong attacker.

local ENTITY = _R.Entity --Grab the entity metatable

function ENTITY:IgniteWithCredit(duration,radius,igniter)
	self.ignitedby = igniter||self.ignitedby

local firecredit = function(ent,inflictor,attacker,amount,dmginfo)
	if attacker:IsValid() && (attacker == inflictor) && ((attacker:GetClass() == "entityflame") && ent.ignitedby && ent.ignitedby:IsValid()) then

You also shouldn’t be resetting the igniter with timer.Simple, because if the entity gets ignited again and the igniter is changed the timer will kick in and unset it. It also is a bad idea to be resetting the attacker from a static amount of time like that, especially one that’s so short since the entity will probably burn longer than that. If you really want to have the igniter reset, have the entity keep track of the last time it was burned by an entityflame in the EntityTakeDamage hook. If the last time it was burned was more than say a second ago, that means the entity has been extinguished since then and you can reset the igniter.

Hm :confused: cant seem to get it to work.

Too much PHP.

You need to be a bit more specific if you want help. Saying “it doesn’t work” isn’t enough to come to a solution with. If you have an error, post it. Note that this won’t automatically set kill credits just for setting something on fire (nothing will). If you’re using the code above, you need to be using ent:IgniteWithCredit instead of ent:Ignite in your script.

Can’t you just use [lua]dmginfo:SetAttacker( self.Owner )[/lua] rather than [lua]dmginfo:SetAttacker( ent.ignitedby )[/lua]

There’s no error nothing, it acts exactly the same as ent:ignite()

I did use ent:IgniteWithCredit(duration,radius,self) :confused:

local lastIgniter

function _R.Entity.IgniteByPlayer(self,d,r,p)

lastIgniter = p



if ent:GetClass() == "entityflame" and ValidEntity(lastIgniter) then

    lastIgniter = nil



Wouldn’t this override the last igniter the moment another attacker was actively pursuing someone?

The local variable only allows one attacker at a time, rather than setting the value within the entity’s table.

True that. Depends on how you want it to act. This will work if you only want to guy who ignited him first to get credit for the kill.

Clever, I see. Kill stealers. :v:

Incase it is unclear, the entityflame entity will only be created when he is first ignited. Igniting a burning entity again won’t make a new entityflame (I’ve tested this)