PropKill Detected

Now regarding PropKilling. On this server, they have a system where whenever you propkill, this message will display in chat.

"You Currently have 4 warnings.
You will be banned for 60 minutes when this number reaches 12.
Your prop kill warnings count will be reset in 20 minutes.
Nickname here <STEAM_0:0:00000000> prop killed Nicknamehere"

Is this an addon I can find somewhere, or is this is a private script?
I mean honestly, this is something a server owner dreams about.
I need this </3
Thanks everyone, I appreciate your time to read this.

Here’s a tip: If you want to be an efficient server owner, learn how to code Lua, even if it is the basics. It’s really easy to pick up ( not meaning you can create a gamemode within your first few months )…

That thread was for PropPush. I’m talking about an
Actual system like said above.
My original thread is outdated so I’m reviving it
However on a different topic.

Edit: I know how to edit Lua bro. I revisioned DarkRP from scratch.
I am a basic lua coder, with MUCH much more to learn.
I am not advanced. Which is exactly why I’m asking if anyone else would be courteous enough to help me out. I need to progress and learn!

Regarding PropPush/PropKill

I think that was about both. You only got one of your questions answered. You shoulda just asked for the other question to be answered in that thread.

Anyways, like they said, you need to set up a OnDeath hook and check if the killer was a prop. If so, get the owner and give him the warnings.

[editline]17th May 2012[/editline]

BTW my point with my previous post was that you asked for them to give you the code. They told you how to do it, if you really want to learn, you should use and search for your functions you need then code it yourself. That’s how I learned and am still learning.

I’ll be kind and start you off.

Here’s the hook (it’s really a function that I’m linking you to) you need:

Yeah, you’re right. But I just made a new thread. It makes me feel more organized o.O

Also, thanks for the help, I appreciate it (:
Ill try to do what I can, but I still need help/suggestions and anyone else’s input would really make a difference.

Edit: Thanks for that link, never heard of it before. Really makes it easier lmao!

I’ll give you a basic run down how this should go… Note, you can not just copy and paste this, you have to figure out the functions and stuff to put in.

hook.Add( “PlayerDeath”, “WarnPropKillers”, function( victim, inflictor, attacker )
if inflictor:IsProp() then – Figure out how to check if it is a prop ( I honestly don’t know how to do this :stuck_out_tongue: )
Warn( attacker, victim )
end )

function Warn( ply, vic )
local warnings = ply:GetWarnings() --You need to figure out how to save the player’s warnings
timer.Remove( ply:Nick() … “_ResetWarnings” )
if warnings >= maxwarnings then
ply:Ban( 60, “Too many prop-kills.” )
ply:SetWarnings( warnings + 1 ) --Also need to figure out how to set the player’s warnings
SendUserMessage( “SendWarningMessage”, ply, warnings )
SendUserMessage( “SendAllMessage”, ply:Nick(), ply:SteamID(), vic:Nick() )
timer.Create( ply:Nick() … “_ResetWarnings”, 1200, 1, function() ply:SetWarnings( 0 ) end ) --Again, figure out how to set player’s warnings.

if CLIENT then

usermessage.Hook( “SendWarningMessage”, function( data )
local warnings = data:ReadLong()
chat.AddText( Format( [[You Currently have %i warnings.
You will be banned for 60 minutes when this number reaches 12.
Your prop kill warnings count will be reset in 20 minutes.]], warnings ) )
end )

usermessage.Hook( “SendAllMessage”, function( data )
local nick = data:ReadString()
local id = data:ReadString()
local vic = data:ReadString()
chat.AddText( Format( “%s <%s> prop killed %s”, nick, id, vic ) )
end )


This is just a rough draft of how I would do it, I suggest setting player’s warnings using PData. (SetPData / GetPData) There might be errors in there and missing info and I did it on purpose so you can try to learn instead of just copy and pasting.

Wow thanks, I had a whole different format going lol.
Thank you!
Ill give this a go, and if I get confused,
Ill try to get some of my coder friends to help me out.

BTW you might want to do ply:SetWarnings( warnings + 1 ) before you check the amount of warnings they had. I added that in last because I forgot and didn’t think of where I was putting it.

The irony here is just ridiculous

Instead of creating a whole new function (SetWarning) why not just assign the player a variable and use the PlayerDeath hook you already intend to use?

I don’t see your point, Pencil. Yes, I’ve made a lot of threads but they are completely different subjects. And he asked two questions in one thread, got one of them answered…

If I ask something and get it solved and have a question similar to that I ask that question unless the other thread is very old.

Also, he can do it how ever he wants. I just did those because he said he wants to learn so he should figure out how to work the rest after I give him a template. Like I said, I suggest him using GetPData and SetPData.

Why would he use PData…? Does the amount of propkills really need to be saved?

You can try this:

hook.Add( “PhysgunPickup”, “Propkill Warning Pickup”, function( p, e )

if e:GetClass() == "prop_physics" then
	e.LastPickup = p

end )

hook.Add( “PlayerDeath”, “Propkill Warning Death”, function( v, i, a )

if i:GetClass() == "prop_physics" then
	if i.LastPickup and i.LastPickup:IsValid() then
		local ply = i.LastPickup
		ply:ChatPrint( "Propkilling is not allowed.")
		if ply.PKWarn then
			ply.PKWarn = ply.PKWarn + 1
			if ply.PKWarn &gt;= 3 then
				ply:Kick( "Propkilling." )
			ply.PKWarn = 1

end )
Should be a bit easier to modify, as it already works :v:

Your system makes it so I can propkill someone more then once every minute and still get away with it… which is hard in itself to do.

Edit Shadow, I was referring to the 12 warning system.

Thanks. It’s missing some of the stuff.
It should ban the player for 60mins not kick.
The reset interval is kind of exploitable.
And it should post the SteamID in chat.
I’m sure I can do this and I really appreciate all of your help everyone.