• SWEP attacks and can't set the same entity on fire more than once
    1 replies, posted
I've been making some zombie sweps and everything works fine, I wanted to make a zombie swep that ignite any entity that was hit for 5 seconds and it works fine. But the problem is the swep will not set the same entity on fire more than once. [B]Code with the ignite part in it:[/B] [CODE]function SWEP:Think() if not self.NextHit or CurTime() < self.NextHit then return end self.NextHit = nil local pl = self.Owner local vStart = pl:EyePos() + Vector(0, 0, -40) local trace = util.TraceLine({start=vStart, endpos = vStart + pl:GetAimVector() * 65, filter = pl, mask = MASK_SHOT}) local ent if trace.HitNonWorld then ent = trace.Entity elseif self.PreHit and self.PreHit:IsValid() and not (self.PreHit:IsPlayer() and not self.PreHit:Alive()) and self.PreHit:GetPos():Distance(vStart) < 110 then ent = self.PreHit trace.Hit = true end if trace.Hit then pl:EmitSound("npc/zombie/claw_strike"..math.random(1, 3)..".wav") end pl:EmitSound("npc/zombie/claw_miss"..math.random(1, 2)..".wav") self.PreHit = nil if ent and ent:IsValid() and not (ent:IsPlayer() and not ent:Alive()) then local damage = 25 local igniteForSeconds = 5 ent:Ignite(igniteForSeconds,0) local phys = ent:GetPhysicsObject() if phys:IsValid() and not ent:IsNPC() and phys:IsMoveable() then local vel = damage * 423 * pl:GetAimVector() phys:ApplyForceOffset(vel, (ent:NearestPoint(pl:GetShootPos()) + ent:GetPos() * 2) / 3) ent:SetPhysicsAttacker(pl) end if not CLIENT and SERVER then ent:TakeDamage(damage, pl, self) end end end[/CODE]
Please help, I really need this
Sorry, you need to Log In to post a reply to this thread.