DotProduct of two vectors is positive if vectors have the same directions, 0 if vectors are perpendicular, and negative if vectors have opposite directions.
In your case, first vector is gun actor forward vector.
Second vector will be direction vector from gun to target actor. It can be calculated by formula:
Normalize(TargetLocation - GunLocation)
So, dotproduct>=0 if target in front of gun, and dotproduct<0 if target is behind of gun.