Do something like this
EntityPickmode building,2,true If EntityInView(Light,Camera) and EntityVisible(Light,camera) ;Do lensflare endif