Help with autoturret aim plugin
Hello, I need help with autoturret targeting plugin... so far i have this 

private IEnumerator turretTask(AutoTurret turret)
{
while (true)
{
IEnumerable<BaseNetworkable> s = BaseNetworkable.serverEntities.Where(x => x is BaseHelicopter);
IEnumerable<BaseNetworkable> entities = s.ToList();

BaseCombatEntity entity = (BaseCombatEntity) entities.ElementAt(0);
Vector3 a = entity.transform.position;
Vector3 b = turret.ServerPosition;
double xx = a.x - b.x;
double yy = a.z - b.x;
double cc = xx / yy;
float squr = (float)Math.Cos(cc);
//if(entity.)
float por = Vector3.Distance (entity.transform.position, turret.transform.position);
PrintToChat("Debug:" + por);

if (por < 100.0f)
{
turret.SetTarget(entity);
turret.FireGun(entity.ServerPosition,squr,null,entity);
}
yield return new WaitForSeconds(1);
}
}
object OnTurretStartup(AutoTurret turret)
{
ServerMgr.Instance.StartCoroutine(turretTask(turret));
return null;
}
Please explain what you actually want to do. Just saying so far I have this wont help us to help you.
to target basehelicopter its obvious from code

Merged post

nobody?