How to determine if Angle is faced right or left of a Vector

Hello, Facepunchers! I have stumbled upon a problem making something. I need to detect wether if a position if right or left (Or perfectly aligned) with my character’s rotation. For example if I have a point in the distance and I look right of it, I need a function that I look right of the target. If I look left of it, I need the function to return I look left of it. I have some ideas (Calculating the angle between the player and the object, then with calculations check how many degrees it is off the target), but I have no idea how to actually write them (Might as well be the time though, pretty late at me ;))

[lua]
function PLAYER:FacingVector( vec )
local relang = ( self:GetPos() - vec ):Angle()
local facing = relang - self:EyeAngles()

if( facing.y <= -1.5 ) then
    return -1 -- Facing left
elseif( facing.y >= 1.5 ) then
    return 1 -- Facing right
else
    return 0 -- Facing directly
end

end

ply:FacingVector( ent:GetPos() )
[/lua]
Enjoy.

Thanks! Going to test soon :wink:

Try modifying this.

Modify it with a.y instead of a.x