This one works for sure! Even if it looks a bit weird (there is a better way to detect objects with C_SCAN).
Code:
result = c_scan(my.x,my.pan,vector(120,80,200),IGNORE_ME|SCAN_ENTS);
if(result > 0)
{
	if(you == player)
	{
		vec_set(aim_target.x,you.x);
		if(c_trace(my.x,aim_target.x,IGNORE_MODELS) == 0){got_target = 1;}else{got_target = 0;}
	}
}

You can download an example when I tried to make auto-aiming thing for FPS.
Here:
Download link


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung