Turn off CharacterControl Component Through Script?

I have seen this question once before, but their was no anser. so how would i script it to turn off the "Character Controller" Component because there is no check box so i cant disable it. i tried this

var player:Transform;

function Update() {

player.GetComponent(CharacterController).enabled = false;
}

And this should work but it doesn't because there is no check box, I works on my other components that do have check boxes.

You need to make a boolean (true or false) to make a check box. Try this:

var player:Transform; var on : bool = true;

function Update() {

if(on){

player.GetComponent(CharacterController).enabled = true;

}else{

// what ever

}

}