• ents.FindInCone
    3 replies, posted
I've been having trouble with ents.FindInCone, I've been messing with it for like 2 hours and can't get it to work.. I have no idea how it works. It's just really weird, it would do things that make no sense. I've been searching and searching and I couldn't find anything of help besides that one wiki page, which doesn't work. Here is the math on the wiki page, which I'm guessing I should use, but I can't get it to work either. [lua] local DistV=E:GetPos()-vPos if DistV:Dot(vDir) > fDistance -- the plane and DistV:Length() < fRadius -- the sphere then add_to_list(E) end [/lua] Here's my fail train of code: [lua] function SWEP:PrimaryAttack() if SERVER then self.Weapon:SetNextPrimaryFire(CurTime() + 0.3) local ConeEnts = ents.FindInCone(self.Owner:GetPos(),self.Owner:GetAimVector(),300,243) --Defined for i,ent in pairs(ConeEnts) do --All of them? if ent:IsValid() and ent:IsPlayer() then if ent!=self.Owner then ent:SetHealth(ent:Health()+8) --Heal him self.Owner:SetHealth(self.Owner:Health()+3) self.Owner:EmitSound(ShootSound) end --Sound. DW about it. if ent:Health()>ent:GetMaxHealth() then ent:SetHealth(ent:GetMaxHealth()) end if self.Owner:Health()>self.Owner:GetMaxHealth() then self.Owner:SetHealth(self.Owner:GetMaxHealth()) end end end end end [/lua] Here's what I'm trying to get it to do: [media] [url]http://i55.tinypic.com/294gdhu.jpg[/url] [/media]
What was the error code it looks like you have to many ends
No error. It just doesn't work. And no, I have enough ends. edit: I hadn't checked this page in 3 hours, I randomly decide to and it says someone posted 1 minute ago. The odds!?! I must be [img_thumb] http://planetsmilies.net/msn-smiley-6661.gif [/img_thumb]
-snip-
Sorry, you need to Log In to post a reply to this thread.