Hi,
I'm trying to use an anti-prop kill script but it's giving me an error, here is the script and error.
[code]
function PlayerHit( ent, inflictor, attacker, amount, dmginfo )
if ent:IsPlayer() and dmginfo:GetDamageType() == DMG_CRUSH then
dmginfo:ScaleDamage( 0.0 )
end
end
hook.Add( "EntityTakeDamage", "PlayerHit", PlayerHit )
[/code]
[code]
[ERROR] gamemodes/darkrp/gamemode/antipropkill.lua:2: attempt to index local 'dmginfo' (a nil value)
1. v - gamemodes/darkrp/gamemode/antipropkill.lua:2[/code]
[lua]
local Ent = FindMetaTable("Entity")
function Ent:IsProp()
return self:GetClass() == "prop_physics"
end
hook.Add("EntityTakeDamage", "pk", function(ent, attacker)
if ent:IsPlayer() and attacker:IsProp() then
-- do whatever here
end
end
[/lua]
perhaps?
[QUOTE=tyguy;39788040][lua]
local Ent = FindMetaTable("Entity")
function Ent:IsProp()
return self:GetClass() == "prop_physics"
end
hook.Add("EntityTakeDamage", "pk", function(ent, attacker)
if ent:IsPlayer() and attacker:IsProp() then
-- do whatever here
end
end
[/lua]
perhaps?[/QUOTE]
What is the command to cause the damage to not apply/be reversed?
EntityTakeDamage only takes two arguments now.
[url]http://gmodwiki.net/Lua/Hooks/Base/EntityTakeDamage[/url]
Here, you can use my script, it might be messy, I wrote it in a bus when plague of prop killers attacked my server and I had to write it immediately.
[lua]local AMS = {}
function AMS.PropDamage( target, inflictor )
if target:IsPlayer() and inflictor:GetClass() == "prop_physics" or inflictor:GetClass() == "prop_dynamic" then
return false
else
return true
end
end
hook.Add("PlayerShouldTakeDamage", "Anti PropDamage", AMS.PropDamage)[/lua]
Althought it doesn't work for bathtubs, sofas and a drawer (since it pushes you into ground so you take world damage instead of prop damage, either that or no fall damage lol)
+If you want them not to be able to throw props
[lua]function AMS.PropKill( ply, ent )
if not IsValid(ent) then return end
ent:SetPos(ent:GetPos())--That trick resets velocity
end
hook.Add("PhysgunDrop", "Anti PropKill", AMS.PropKill)[/lua]
I'm waiting for Falco to come in and start ranting about how HURR MY ANTIPROPKILL DIDNT WORK SO IT IS IMPOSSIBLE TO MAKE AN EFFECTIVE ANTIPROPKILL SCRIPT TRUST ME I KNOW ALL.
[QUOTE=SashaWolf;39789232]I'm waiting for Falco to come in and start ranting about how HURR MY ANTIPROPKILL DIDNT WORK SO IT IS IMPOSSIBLE TO MAKE AN EFFECTIVE ANTIPROPKILL SCRIPT TRUST ME I KNOW ALL.[/QUOTE]
You're misrepresenting my reasoning. You're making a strawman of my opinion, to ridicule it.
prop kill scripts don't work because it is impossible to accurately detect the difference between a valid prop kill and an accident or a role play situation. this impossibility is created because the difference relies on the intent of the actor.
Besides, it's impossible to even know who the prop killer is, it definitely isn't the owner of the prop. It's not the owner of the prop that pushed the prop and it's not the person who touched the prop last. Again, intent is what decides who the actor is.
One can think of two different situations: one in which the prop killer is actually prop killing and another where an accident/rp thing happened. one can prove that the situations look exactly the same data - wise and therefore impossible for any algorithm to accurately decide the difference.
In any case, the reason I have for saying it's impossible is not that "I tried it and didn't work". That's the way you might reason about how DarkRP created life at the beginning of time. it's not how reasoning works for rational people.
Or you could just disable prop damage entirely. Just do what Greetings suggested:
[CODE]function PlayerHit( ent, dmginfo )
if ent:IsPlayer() and dmginfo:GetDamageType() == DMG_CRUSH then
dmginfo:ScaleDamage( 0.0 )
end
end
hook.Add( "EntityTakeDamage", "PlayerHit", PlayerHit )[/CODE]
[QUOTE=FPtje;39793771]-snip-[/QUOTE]
Lol, I was just giving you shit, not trying to make a valid argument.
I actually saw an antipropkill system earlier that I felt worked really well. If your props were unfrozen or not constrained with any tool, they would be faded (or whatever, like how FPP makes props transparent when someone spawns them too fast).
[lua]
local APKents = {}
hook.Add("PhysgunDrop", "APK-PhysgunDrop", function( ply, ent )
if IsValid(ent) and ply:IsPlayer() and !ent:IsPlayer() then
if timer.Exists("APK-"..tostring(ent:GetCreationID())) then
timer.Destroy("APK-"..tostring(ent:GetCreationID()))
table.remove(APKents, ent:GetCreationID())
ent.APKply = Entity(0)
end
APKents[ent:GetCreationID()] = ent
ent.APKply = ply
timer.Create("APK-"..tostring(ent:GetCreationID()), 5, 1, function()
if IsValid(ent) then
ent.APKply = Entity(0)
APKents[ent:GetCreationID()] = Entity(0)
end
end)
end
end)
hook.Add("EntityTakeDamage", "APK-EntityTakeDamage", function( target, dmginfo )
local ent = dmginfo:GetInflictor()
local function StopDamage(ply, ent, attk)
print(attk:Name() .. " attempted to prop kill " .. ply:Name())
dmginfo:SetDamage(0)
dmginfo:SetDamageForce(-dmginfo:GetDamageForce())
local phys = ent:GetPhysicsObject()
if phys:IsValid() then -- Always do a IsValid check! The ent might not have physics!
phys:SetVelocity(-phys:GetVelocity() * phys:GetMass() * 10^10)
timer.Simple(0.3, function() ent:Remove() end)
end
end
if APKents[ent:GetCreationID()] == ent then
if target:IsPlayer() and ent.APKply:IsPlayer() then
StopDamage(target, ent, ent.APKply)
end
if target:IsPlayer() and dmginfo:GetDamageType() == DMG_CRUSH then
for k,v in pairs(APKents) do
if IsValid(v.APKowner) and v.APKowner != target and IsValid(v) and IsValid(ply) then
if target:GetShootPos():Distance(v:GetPos()) < 150 then
if v:GetVelocity() > Vector() then
StopDamage(target, v, v.APKply)
end
end
end
end
end
end
end)
hook.Add("EntityRemoved", "APK-EntityRemoved", function(ent)
if IsValid(ent) then
if APKents[ent:GetCreationID()] == ent then
ent.APKply = Entity(0)
ent.APKowner = Entity(0)
table.remove(APKents, ent:GetCreationID())
end
end
end)
if(cleanup) then
local Clean = cleanup.Add
function cleanup.Add(Player, Type, Entity)
if(Entity) then
local Check = Player:IsPlayer()
local Valid = Entity:IsValid()
if(Check and Valid) then
Entity.APKowner = Player
end
end
Clean(Player, Type, Entity)
end
end
[/lua]
Prop kill prevention scripts don't work or fuck up the genuine players.
Prop kill [b]detection[/b] scripts don't work, fuck up the players and allows minges to get [i]anyone[/i] banned.
[url=http://www.youtube.com/watch?v=PHiDushdnpo]Don't install the script given in above post or minges [b]will[/b] get innocent people banned.[/url]
I don't like prevention scripts, but detection scripts are the worst thing you can do to a DarkRP server besides permabanning everyone immediately.
I got this off the workshop, have been using it for a few months and haven't really had any issues with it. It does disable fall damage but that's cool with me. [url]http://steamcommunity.com/sharedfiles/filedetails/?id=106316297[/url]
[lua]function antiPropDamage (victim, attacker)
if (attacker:IsWorld()) then
return false
end
if (attacker:IsValid()) then
if (attacker:GetClass() == "prop_physics" or attacker:IsWorld() or attacker:GetClass() == "prop_vehicle_jeep" or attacker:GetClass() == "darkrp_laws") then
return false
else
if (attacker:IsPlayer()) then
if (attacker:InVehicle()) then
return false
end
else
return true
end
end
end
end
hook.Add("PlayerShouldTakeDamage", "nopropdamage", antiPropDamage)[/lua]
[QUOTE=ikoN420;39805176]I got this off the workshop, have been using it for a few months and haven't really had any issues with it. It does disable fall damage but that's cool with me. [URL]http://steamcommunity.com/sharedfiles/filedetails/?id=106316297[/URL]
[/QUOTE]
How can disabling fall damage be ok with you? Unless of cause you run an unserious-rp server.
[QUOTE=FPtje;39805146]Prop kill prevention scripts don't work or fuck up the genuine players.
Prop kill [b]detection[/b] scripts don't work, fuck up the players and allows minges to get [i]anyone[/i] banned.
[url=http://www.youtube.com/watch?v=PHiDushdnpo]Don't install the script given in above post or minges [b]will[/b] get innocent people banned.[/url]
I don't like prevention scripts, but detection scripts are the worst thing you can do to a DarkRP server besides permabanning everyone immediately.[/QUOTE]
The script itself doesn't ban players. As long as the server has competent admins, there shouldn't be any problems.
[QUOTE=FPtje;39805146]Prop kill prevention scripts don't work or fuck up the genuine players.
Prop kill [b]detection[/b] scripts don't work, fuck up the players and allows minges to get [i]anyone[/i] banned.
[url=http://www.youtube.com/watch?v=PHiDushdnpo]Don't install the script given in above post or minges [b]will[/b] get innocent people banned.[/url]
I don't like prevention scripts, but detection scripts are the worst thing you can do to a DarkRP server besides permabanning everyone immediately.[/QUOTE]
It doesn't base it off the owner, it bases it off if someone has let go of a prop with the physgun, if within five seconds someone is killed with that prop then the prop is removed and that player who last touched name is printed. The only way to abuse this is if there are say 5 people within one small area, if one player spawns a prop and another one quickly spawns his prop and pushes the first players prop into one of the other 4 players then will it display an incorrect message, however no one will be prop killed.
But I do understand that if it is past those 5 seconds the player will die however it will not notify that someone prop killed them.
Admin's > Any script .. just saying.
If you want a script that can work (Tho' I'm too lazy to write it right now)
You could run "ent:SetSolid(SOLID_BSP)" on the prop that's being held and reset it on drop; if its not inside a player/another prop and after 10 seconds have past.
[QUOTE=Kenny_;39805394]The script itself doesn't ban players. As long as the server has competent admins, there shouldn't be any problems.[/QUOTE]
neither did the script in the video.
Lua never lies, on everything admins are right to trust Lua to get information. when lua prints gun kills, it is always right. when lua prints admins, money or health it is always right. Good admins can trust Lua, and rightfully so.
that is unless you make an incorrect script. prop kill detection scripts are incorrect. To any admin, a prop kill message looks exactly like any other kill message. To an admin, they are equally reliable.
unless the admin knows the mechanism and the exploits of such scripts precisely like a prop killer does, only then can he know that these scripts are unreliable and therefore useless. These scripts abuse lua to bend it to do things it cannot do. This is disastrous regardless of how good admins are.
[editline]5th March 2013[/editline]
[QUOTE=theVendetta;39805450]It doesn't base it off the owner, it bases it off if someone has let go of a prop with the physgun, if within five seconds someone is killed with that prop then the prop is removed and that player who last touched name is printed. The only way to abuse this is if there are say 5 people within one small area, if one player spawns a prop and another one quickly spawns his prop and pushes the first players prop into one of the other 4 players then will it display an incorrect message, however no one will be prop killed.
But I do understand that if it is past those 5 seconds the player will die however it will not notify that someone prop killed them.[/QUOTE]
Follow someone and wait for them to pick up and drop a prop. as soon as he drops it, push the prop into the person who dropped it. Then shout prop kill in ooc. you have a full five seconds to do whatever you want with the dropped prop.
if you don't want to go in a hassle and prop kill someone without getting detected, spawn two props and push one prop with the other. make sure you never pick up the first prop.
Algorithms are correct if they give the right output AND are complete (always gives an answer). Your algorithm is neither.
Your idea is that you can generally trust the script in most cases. This misplaced trust is EXACTLY what will fuck any server up running it. Too many people know how to abuse it. Any server running these scripts WILL have innocent players banned.
Let me back that last statement up with a mathematical fact.
There is a chance that your script gives the wrong answer. How small this chance is doesn't even matter for the evidence. You can argue yourself silly about how small the chance is, but until there is NO chance, this proof remains valid.
[u]The chance of event x happening approaches 1 as time increases. [/u] It's the [url=http://en.wikipedia.org/wiki/Infinite_monkey_theorem]infinite monkey theorem[/url], or at least its abstract.
There's a chance of your script being wrong. Call this "event x".
Servers running this script run indefinitely.
This theorem mathematically proves, that the longer the server runs, the chance that your script points at the wrong player as the prop killer increases. Your script [b]will[/b] be wrong and can therefore [b]never[/b] be trusted. [b]Any[/b] ban based on the script alone has a chance of having someone innocent banned. The theorem applies here too. Innocent people [b]will[/b] get banned as the bans relying on the script increase.
[b]Text too long, have a conclusion[/b]
- prop kill detection scripts cannot be trusted
- Admins are right to trust any other script except for detection scripts
- Admins trust the detection script, but are unaware that it's right shit
- If admins ban relying on the information of the script, which they will [b]because Lua never lies[/b], people [b]WILL[/b] get banned innocently.
- Any information from the script will therefore have to be verified through other means. The best way imo is spectating
Just skip the script altogether and use spectate instead when someone is prop killed. Look at the person who spawned the prop that prop killed someone, spectate them and ban them [b]as soon as you see them do it[/b].
[QUOTE=FPtje;39805146]Prop kill prevention scripts don't work or fuck up the genuine players.
Prop kill [B]detection[/B] scripts don't work, fuck up the players and allows minges to get [I]anyone[/I] banned.
[URL="http://www.youtube.com/watch?v=PHiDushdnpo"]Don't install the script given in above post or minges [B]will[/B] get innocent people banned.[/URL]
I don't like prevention scripts, but detection scripts are the worst thing you can do to a DarkRP server besides permabanning everyone immediately.[/QUOTE]
I agree with you on the failures of detection, but the prevention one I saw did not interfere at all with genuine gameplay and worked quite well. I've seen some that work quite well for their given purpose. I think it is foolish to claim that it is impossible to do something, especially for people like us who's job is to innovate.
I agree with you on the spectate part, but good prevention scripts help minimize propkilling issues. I definitely agree things can be exploited (I mean, I do spend half of my time on gmod causing trouble in servers), but from my perspective I believe that it is possible to create a script that mostly prevent propkilling. You might have people that figure out some fringe way to exploit it, but that's what spectating is for I guess.
Any problem can be solved by removing enough involved parties. The problem with removing parties from a situation is that these parties are often not only there to cause the problem.
In an extreme example:
Prop killing can be solved by removing multiplayer from Garry's mod. This immediately sounds ridiculous, but in essence it does the same as
Prop killing can be solved by removing physics damage from Garry's mod.
The essence of these solutions are the same: removing involved game elements. Except people only argue the former would be ridiculous. Instead, I argue that the latter solution is ridiculous in the core. Physics damage is not only there to cause the prop killing problem. It is there to provide semi-realistic and in some cases more fun gameplay. Removing physics damage removes everything it does, including the genuine fun people can have with it.
Having said that, I must stress that prevention scripts aren't nearly as bad as detection scripts.
And about the impossibility. No one's opinion, no one's innovation can ever affect an impossibility proof as long as the premises of the proof hold. Besides, in computer science, proofs of impossibility tend to stimulate innovation rather than going against it. When it was proven that sorting cannot be done in less than O(n lg n) time, scientists have been able to construct algorithms that take O(n) time (which is faster) by bypassing the premises and making assumptions about the input. But I digress. Making claims about impossibilities is not foolish provided that proper arguments are given, which I believe I do.
[QUOTE=Nak;39806669]Admin's > Any script .. just saying.
If you want a script that can work (Tho' I'm too lazy to write it right now)
You could run "ent:SetSolid(SOLID_BSP)" on the prop that's being held and reset it on drop; if its not inside a player/another prop and after 10 seconds have past.[/QUOTE]
Wouldn't this actually work?
Make it nocollide while held, then make a timer to release the nocollide after 5 seconds or 10.
The plan was to try and reduce the amount of prop killing and what a prop kill did occur, I have prop spawning logs to see who spawned a specific prop before that prop kill occurred. From that I am able to investigate who was to blame for that specific prop kill.
Obviously, that wouldn't be 100% accurate but it's a method that will reduce it slightly. Especially with people that are fairly new to GMod and come on to be idiots.
[QUOTE=FPtje;39806678] -- [/QUOTE]
The script should never be used a solution, more like a tool.
If you remove that one line that prints the code then it makes it harder for prop killers to prop kill. This along with administration will help to stop prop killers from interrupting gameplay of people who are actually abiding by the rules.
A suspicion is what the script can be at best, but a script for suspicions is easily mistaken for a script that is always right, see my reasoning above.
I'm admin on several servers. here's what I do: when I see a prop kill, I look at the console to see who spawned the prop. I do this by matching the model of the prop killing prop with the last person who spawned a prop with that model. doing this research myself forces me to accept that the method isn't accurate. So I spectate either the spawner of the prop or the victim.
I only ban people when I catch them red handed, and with spectate I make sure I do. With spectate I am often the most efficient admin in a server.
Unless the server owner happens not to want players to be able to kill other players with anything other than guns. Then disabling physics damage is a perfectly viable option.
I'm fully aware you enjoy the idea of traps and murderous contraptions but they become spectacularly annoying in any form of RP more serious than DarkRP default.
Hmm, how about if the prop, when moving at certain speed, it nocollides only to players and bots? If "the" speed is too low players may transpass props when weld and unfroze, if too high then it doesn't work properly.
I can't find any exploitation for this but however I find it impossible to make since it would require to check the prop's speed constantly, slowing down the server that is working on
props don't need speed to kill.
Final solution: Disable props, I don't see any other way to stop propkills.
So the only problem with the script that detects the last person to touch it is that there could be no last person to touch it, but a last prop? Could you not simply store every props last prop contacts and then cycle up through the contacts until a prop had been touched with a physgun?
I would like to try this out myself, though I don't play RP and I don't know what a valid prop kill is.
It could point at the wrong player as the prop killer, which is crucial in my argument why you shouldn't do it.
Under what circumstances?
Sorry, you need to Log In to post a reply to this thread.