To check if the ped is facing another you need to find the rotation, to check if the ped can see the other you have to check if the client player is some element so that the function doesn't get called for all because the function uses the local player.
So, you would do this:
if ( thePlayerElement == localPlayer ) then
if ( isElementInPhotograph ( otherElement ) ) then
--do something
end
end
Be sure to copy the function to your file, it's not a built-in one.