Prop killing/pushing

Hey guys i been working on a script to prevent prop killing and prop pushing, it works but its not accurate at all.

[lua]
hook.Add(“PhysgunPickup”, “-PickMeUp”, function(ply, ent)
ent.OldCollision = ent:GetCollisionGroup()
ent:SetCollisionGroup(COLLISION_GROUP_WEAPON)
end)

hook.Add(“PhysgunDrop”, “-DropMeh”, function(ply, ent)
local Fade = true

for k,v in pairs(ents.FindInSphere(ent:GetPos(), 30)) do
                if v:IsPlayer() then Fade = false break end
    end


if !Fade then 
	ply:ChatPrint("Your prop is inside somebody!")
else
	ent:SetCollisionGroup(COLLISION_GROUP_NONE)
end

end)
[/lua]

I am stuck, IsPenetraiting doesnt work, ive searched facepunch only thing i can find is basic stuff. tried doing ent:GetPhysicsObject():GetPos() doesnt work well either.

Are you sure you’re using IsPenetrating correctly? Also, ent:GetPhysicsObject():GetPos() is ent:GetPos()

How should IsPenetrating be used?

**[PhysObj.IsPenetrating

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=PhysObj.IsPenetrating)**
:downs:

You can’t make an anti prop kill script without fucking over genuine players.

Wouldn’t something like this work?
[lua]
hook.Add(“ShouldCollide”,“ShouldCollideTest”,function(ent1,ent2)
if ent1:IsPlayer() and !ent2:IsPlayer() then
if ent2.ATOwner!=ent1 and ent2.isheld then
return false
end
elseif ent2:IsPlayer() and !ent1:IsPlayer() then
if ent1.ATOwner!=ent2 and ent1.isheld then
return false
end
end
end)

hook.Add(“PhysgunPickup”,“PropPush”,function(ply,ent)
ent.isheld=true
end)

hook.Add(“PhysgunDrop”,“PropPush”,function(ply,ent)
ent.isheld=false
end)
[/lua]

Yes Hyper Iguana ive read that and that is what i used.

And Kenny_ ive tested the ShouldCollide hook, seems to crash when messing with props the server maybe it was just me.

Can’t you just give it a freeze/unfreeze effect when they drop the prop? It’s not harming anyone and it stops prop throwing.
[lua]hook.Add(“PhysgunDrop”, “AntiPP”, function(ply, ent)
timer.Simple(0.01, ent:SetVelocity(0, 0, 0))
end)[/lua]

Get this man a damn medal. No sarcasm intended

No, i need a anti prop killing, not prop throwing…

And yeah i tested that timer, doesn’t work well

It’s just an idea, not proof of concept.

[lua]hook.Add(“PhysgunDrop”, “AntiPP”, function(ply, ent)
timer.Simple(0.01, function() ent:SetVelocity(0, 0, 0) end)
end)[/lua]

Yes i know Hyper…

The only way anyone would really kill anybody with a prop is with throwing it, why would you need to make it so complicated?

Unless they spawn one with lots of weight and hover it over someone and drop it…

^ That

and its not ONLY killing, i do want prop pushing fixed also.

Ive remade the script its a decent script but its not 100% accurate

Then just make it not collide with anything for a second or two after it’s dropped.

[lua]hook.Add(“PhysgunDrop”, “AntiPP”, function(ply, ent)
ent:SetCollisionGroup(COLLISION_GROUP_WORLD) --Collide with world only
ent:SetColor(255,255,255,180) --Opacify it so it’s transparent
timer.Simple(1, function()
ent:SetCollisionGroup(COLLISION_GROUP_NONE) --Reset collision
ent:SetColor(255,255,255,255) --Reset opacity
end)
end)[/lua]

And then they trap people inside a big prop they can’t get out of, unless there is noclip

Admins

If there’s admins why do you need an anti prop killing/pushing script to begin with?