Not sure if this is what you're looking for, but Destiny wrote this up awhile ago.
function Player::objectInView(%player,%object)
{
if(!isObject(%object))
return 0;
//The eye point is the position of the players camera
%eye = %player.getEyePoint();
//The position of the object
%to = posFromTransform(%object.getTransform());
if(vectorDist(%eye,%to) < %range)
return 0;
//Cast a raycast to try and collide with the object
%ray = containerRaycast(%eye,%to,$TypeMasks::StaticShapeObjectType | $TypeMasks::TerrainObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::PlayerObjectType | $TypeMasks::FxBrickObjectType | $TypeMasks::InteriorObjectType,%player);
%col = getWord(%ray,0);
if(isObject(%col) && %col == %object)
{
//The position of the collision
%pos = posFromRaycast(%ray);
//Super Maths C skills go B)
%resultant = vectorSub(%pos,%eye);
%normal = vectorNormalize(%resultant);
//Find the yaw from the resultant
%resultRadians = mAtan(getWord(%normal,1),getWord(%normal,0));
//Find the yaw from the eye vector
%eyeVec = %player.getEyeVector();
%eyeRadians = mAtan(getWord(%eyeVec,1),getWord(%eyeVec,0));
//Convert both of them to degrees for easier understanding
%resultDegrees = mRadToDeg(%resultRadians);
%eyeDegrees = mRadToDeg(%eyeRadians);
//Now the tricky part. In order for the object to be in sight, lets say that the object needs to be within 90 degrees of the players view
//Change 90 to something smaller if you don't like how wide the view is
if(%resultDegrees >= %eyeDegrees - 90 && %resultDegrees <= %eyeDegrees + 90)
return 1;
}
//No object hit, or not the target object, return 0/false
return 0;
}