Awarding kills via traps to a player


I’m basically trying to make it so if I make a trap (say in sandbox), I will get credit for this kill. So far I tried constantly setting

Entity:SetPhysicsAttacker, which I didn’t even get to testing because it turns out it prevents a player’s props from hurting himself, and I tried to change the attacker in the damage data in

GM/ScalePlayerDamage but it seems to not do anything (I guess only the actual damage values are taken from that).

Is there a non-hacky way to make it happen?

… Is there a HACKY way to make it happen?


Use EntityTakeDamage hook to modify attacker/inflictor in CDamageInfo

Well now I feel dumb.

Works great, thank you!