i guss this line
//WITHIN SECTOR RANGE
if (enemypos_vec.x < my.x + scan_sector.x && enemypos_vec.x > my.x - scan_sector.x &&
enemypos_vec.y < my.y + scan_sector.y && enemypos_vec.y > my.y - scan_sector.y &&
enemypos_vec.z < my.z + scan_sector.z && enemypos_vec.z > my.z - scan_sector.z)
should look more like this:
//WITHIN SECTOR RANGE
if (you.x < my.x + scan_sector.x && you.x > my.x - scan_sector.x &&
you.y < my.y + scan_sector.y && you.y > my.y - scan_sector.y &&
enemypos_vec.z < 10&& enemypos_vec.z > -10)
I guess this should work. This will check all ents between -10 and 10 of height.
You problem was (i guess) that you compared the relative x and y coordinates with absolute x and y coordinates.