• GetEyeTrace() SWEP
    2 replies, posted
Hi all, Currently a section of my SWEP:PrimaryAttack() is [CODE] if ( !self:CanPrimaryAttack() ) then return end local eyetrace = self.Owner:GetEyeTrace() if !eyetrace.Entity:IsPlayer() then if !eyetrace.Entity:IsNPC() then return end // Check to see if what the player is aiming at is an NPC or Player end[/CODE] The problem I'm having is that I want it to only detect the entity if its in a certain radius/ next to the player. Thanks, Computer600
Just get the distance of entity via: self.Owner:GetPos():Distance( tracedEnd:GetPos() ) <= 600
[QUOTE=Netheous;42408412]Just get the distance of entity via: self.Owner:GetPos():Distance( tracedEnd:GetPos() ) <= 600[/QUOTE] Thanks, where would I put this in the code?
Sorry, you need to Log In to post a reply to this thread.