Most people would just check the angle - like work out the difference on X and Z between the enemy and player, then deduct the enemy angle. With that, you can tell if the player is within the arc.
Something like...
obj_e=10 `Enemy
obj_p=15 `Player
DX#=object position x(obj_e)-object position x(obj_p)
DZ#=object position z(obj_e)-object position z(obj_p)
D#=sqrt((dx#*dx#)+(dz#*dz#))
So that provides the distances and overal 2D distance between the objects in D#
Now the angle...
A#=wrapvalue(atanfull(DX#,DY#)-object angle Y(obj_e))
Now take that angle and make it unsigned...
If A#>180 then dec A#,360.0
So now its within -180 to 180 - but more useful is that it's the difference between the player and enemy. Now you can do an easy condition, like IF D#<100 and A#>-45 and A#<45 then SPOTTED!
Also, it's quite cool to do an actual visibility check - so pick a random limb on your player model if you have one, or alternatively pick a coordinate around the camera, as if the camera is a head and your picking locations inside it. Anyhoo, with that - do a line intersection check between this location and the enemies eyes, head, whatever you can use that's a limb. With that, you can make it possible to hide behind walls etc - and because you check a random spot, you can get spotted with just your toes sticking out, or if you peek around at the wrong time. This provides a bit of randomness to it - if your out in the open then you'll be spotted, but if your quick and you find good cover, it is possible to get away with it. Just something that I added the last time I did this, and it made a huge difference, made it much more fair.

Health, Ammo, and bacon and eggs!
