Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function IsInDistance(a)
- local function IsLookingAt( ply )
- local yes = ply:GetAimVector():Dot( ( a:GetPos() - ply:GetPos() + Vector( 70 ) ):GetNormalized() )
- return (yes > 0.39)
- end
- for i,k in pairs(player.GetAll()) do
- if not IsValid(a) or not a:Alive() then continue end
- if k:isCP() and k:Alive() then
- local tr_eyes = util.TraceLine( {
- start = k:EyePos() + k:EyeAngles():Forward() * 5,
- endpos = a:EyePos()
- mask = CONTENTS_WINDOW
- } )
- local tr_center = util.TraceLine( {
- start = k:LocalToWorld( k:OBBCenter() ),
- endpos = a:LocalToWorld( a:OBBCenter() ),
- filter = k
- mask = CONTENTS_WINDOW
- } )
- if tr_eyes.Entity == a or tr_center.Entity == a then
- if IsLookingAt(k) then
- return true
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement