Death penalty for attempted prop kill.

I want to make a script that will kill the attacker who tries to kill a player with a prop.
What hook should I start with and any tips?

You can check the inflictor, which is what killed the player, I believe you can check if it’s a prop with
attacker:IsWeapon() and if it isn’t a weapon, it must be a prop

Good idea, although I’d want to keep the victim alive as well.

I’m looking into the hook ‘PlayerShouldTakeDamage’.

If you’re running a DarkRP you may be able to get the prop killer with ent:GetOwner() since they are the owner of the prop that is being used to prop kill.



hook.Add("PlayerDeath", "SomeStupidShtHere", function(victim, ent, attacker)
	if IsValid(attacker) and attacker:IsEntity() then
		RunConsoleCommand("ulx", "slay", attacker:GetOwner())
	end
end)


Not tested, it might work. I’m not le pro with lua but I know my stuff.

That’s not how RunConsoleCommand works, you have to do RunConsoleCommand(“ulx”, “slay”, attacker:GetOwner())

Lol, I know, I just noticed that.
Not a good excuse but, it’s around 3 am and I’m pretty tired. And I also said I’m not a lua pro so. :wink:

Here’s why not, it’s exploity as fuck

I’ve seen that video an hour ago, but thanks.
I just want to do a attacker:kill()

[editline]27th January 2014[/editline]

I tried GetOwner() as suggested by isnipeu and received ‘NULL ENTITY’

It looks like i’d have to do SetOwner() with a ‘PlayerSpawnProp’ hook.
I am too lazy because it’s 3am for me as well.