• SWEP "shoots" through brushed
    0 replies, posted
Hi, I am using a SWEP for Deathrun, which unfortunaly can hit through invisible brushes/walls. What do I do to remove that? [code] local tr = {} tr.start = self.Owner:GetShootPos() tr.endpos = self.Owner:GetShootPos() + ( self.Owner:GetAimVector() * 110 ) tr.filter = self.Owner tr.mask = MASK_SHOT local trace = util.TraceLine( tr ) self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay) self.Owner:SetAnimation( PLAYER_ATTACK1 ) if ( trace.Hit ) then if trace.Entity:IsPlayer() or string.find(trace.Entity:GetClass(),"npc") or string.find(trace.Entity:GetClass(),"prop_ragdoll") then self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER) bullet = {} bullet.Num = 1 bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector(0, 0, 0) bullet.Tracer = 0 bullet.Force = 1 bullet.Damage = self.Primary.Damage self.Owner:FireBullets(bullet) elseif string.find(trace.Entity:GetClass(),"nodraw") then return else self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER) bullet = {} bullet.Num = 1 bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector(0, 0, 0) bullet.Tracer = 0 bullet.Force = 1000 bullet.Damage = self.Primary.Damage self.Owner:FireBullets(bullet) self.Weapon:EmitSound( self.WallSound ) util.Decal("ManhackCut", trace.HitPos + trace.HitNormal, trace.HitPos - trace.HitNormal) end else self.Weapon:EmitSound(self.MissSound,75,math.random(90,120)) self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER) end [/code] I tried to use [code] string.find(trace.Entity:GetCollisionGroup(),"COLLISION_GROUP_PLAYER") [/code] but it doesn't work either
Sorry, you need to Log In to post a reply to this thread.