help i created a lock on scrip in C# it works but i cant unlock and relock it

hello i did a player to player lock on script it works and my player rotats against the enemys position but i cant seem to make it locked and un locked with the alignment of getkey function i cant unlock it
my script just randomly locks on to the taged enemys and dose not unlock when i press the implememnted button can anyone corrent my script and make it work when i press ctrl buttion and make it unlocked when i [press the same buttion help!..

here is the code of my script help please

using UnityEngine; 
using System.Collections;

public class PlayerAI : MonoBehaviour {

public Transform target; 
public int moveSpeed;
public int rotationSpeed;
public int maxDistance;
private Transform mytransform;

void Awake() { 
mytransform = transform; 
}

// Use this for initialization 
void Start () {
GameObject go = GameObject.FindGameObjectWithTag("Enemy");
target = go.transform;
maxDistance = 2;
} 

private void DeselectTarget() {
target.renderer.material.color = Color.blue;
}

// Update is called once per frame 
void Update () {

  if(Input.GetKeyUp(KeyCode.R)) {
  }

  Debug.DrawLine(target.position,mytransform.position, Color.yellow); //Look at target
  mytransform.rotation = Quaternion.Slerp(mytransform.rotation, Quaternion.LookRotation(target.position - mytransform.position),rotationSpeed * Time.deltaTime);
  if(Vector3.Distance(target.position, mytransform.position) > maxDistance) { 
  //move towards target mytransform.position += mytransform.forward * moveSpeed * Time.deltaTime; 
       } 
     } 
   }

thanks for helping i solved the code myself :smiley: now i just need one thing i need my code to select a target when my cross fire looks at him :smiley: can anyone give that code or ill post the code of my corrected code which selects :smiley: so that u can add it and many thanks to all of u for help