Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function AntiPropPushPickup( userid, ent )
- if ent:GetClass() == "prop_physics" then
- ent:SetCollisionGroup( COLLISION_GROUP_WEAPON )
- local r,g,b,a = ent:GetColor();
- ent:SetColor(r,g,b,180)
- end
- end
- hook.Add( "PhysgunPickup", "AntiPropPushPickup", AntiPropPushPickup )
- function AntiPropPushDrop( pl, ent )
- if ent:GetClass() == "prop_physics" then
- ent:GetPhysicsObject():SetVelocity( Vector(0,0,0) )
- ent:GetPhysicsObject():AddAngleVelocity(ent:GetPhysicsObject():GetAngleVelocity( )*-1)
- ent:SetCollisionGroup( COLLISION_GROUP_NONE )
- local r,g,b,a = ent:GetColor();
- ent:SetColor(r,g,b,255)
- end
- end
- hook.Add("PhysgunDrop", "AntiPropPushDrop", AntiPropPushDrop);
- function AntiPropPushFreezing(weapon, physobj, ent, ply)
- if ent:GetClass() == "prop_physics" then
- local rad = ent:BoundingRadius()*1.3
- local inside = false
- for k, ply in pairs(player.GetAll()) do
- if (ply:GetPos():Distance(ent:LocalToWorld(ent:OBBCenter())) < rad) then
- inside = true
- end
- end
- for k, ply in pairs(player.GetAll()) do
- local pos = ply:GetPos() + Vector(0,0,64)
- if (pos:Distance(ent:LocalToWorld(ent:OBBCenter())) < rad) then
- inside = true
- end
- end
- if inside then
- ent:SetCollisionGroup( COLLISION_GROUP_WEAPON )
- local r,g,b,a = ent:GetColor();
- ent:SetColor(r,g,b,100)
- else
- ent:SetCollisionGroup( COLLISION_GROUP_NONE )
- local r,g,b,a = ent:GetColor();
- ent:SetColor(r,g,b,255)
- end
- end
- end
- hook.Add("OnPhysgunFreeze", "AntiPropPushFreezing", AntiPropPushFreezing)
- function AntiPropKill(victim, attacker)
- if(not attacker:IsPlayer()) then
- if (attacker:GetClass() == "prop_physics") then
- return false
- end
- end
- end
- hook.Add( "PlayerShouldTakeDamage", "AntiPropKill", AntiPropKill)
- 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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement