• Death penalty for attempted prop kill.
    7 replies, posted
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?
[url]http://wiki.garrysmod.com/page/GM/PlayerDeath[/url] 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. [code] hook.Add("PlayerDeath", "SomeStupidShtHere", function(victim, ent, attacker) if IsValid(attacker) and attacker:IsEntity() then RunConsoleCommand("ulx", "slay", attacker:GetOwner()) end end) [/code] Not tested, it might work. I'm not le pro with lua but I know my stuff.
[QUOTE=Zephruz;43686886]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. [code] hook.Add("PlayerDeath", "SomeStupidShtHere", function(ent, attacker) if IsValid(attacker) and attacker:IsEntity() then RunConsoleCommand("ulx slay "..attacker:GetOwner()) end end) [/code] Not tested, it might work. I'm not le pro with lua but I know my stuff.[/QUOTE] That's not how RunConsoleCommand works, you have to do RunConsoleCommand("ulx", "slay", attacker:GetOwner())
[QUOTE=isnipeu;43686913]That's not how RunConsoleCommand works, you have to do RunConsoleCommand("ulx", "slay", attacker:GetOwner())[/QUOTE] 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. ;)
Here's why not, it's exploity as fuck [url]http://www.youtube.com/watch?v=PHiDushdnpo[/url]
[QUOTE=Scratch.;43686935]Here's why not, it's exploity as fuck [url]http://www.youtube.com/watch?v=PHiDushdnpo[/url][/QUOTE] 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.
Sorry, you need to Log In to post a reply to this thread.