Disable character controller when in turret


Im making a virtual environment where a character can walk up to a gun turret and can hop into it an look around.

Ive been able to get the camera to swap to the turret aswell as the mouse look.

But i can still see the character moving around when i press the movement keys.

Im just wondering if there is anyway to disbale the ‘character motor’ component of the character while im in the turret

This is my script so far. Im using JAVA

var camera1 : GameObject;
var camera2 : GameObject;
var turret_camera : Camera;

private var inturret : int;

function Start () {
   camera1.active = true;
   camera2.active = false;
   turret_camera.camera.enabled = false;
   inturret = 0;
   GetComponent("Character Motor (Script)").enabled = false;

function Update () {
   if (Input.GetKeyDown ("e")){
		if (inturret == 0){
      camera1.active = false;
      camera2.active = true;
	  turret_camera.camera.enabled = true;
	  //camera1.GetComponent("CharacterMotor").enabled = false;
	  inturret = 1;
	  camera1.active = true;
	  camera2.active = false;
	  turret_camera.camera.enabled = false;
	  //camera1.GetComponent("CharacterMotor").enabled = true;
	  inturret = 0;

heres how u can disable the CharacterController, or any other component with this line

  var player : GameObject;
    player.GetComponent("CharacterController").enabled = false;

  public GameObject player;
    player.GetComponent<CharacterController>().enabled = false;

u just need to add the player in the inspector and u r set