Script keeps functioning when disabled

Hey everyone. I have a shooting script for a tank, and when there are no more enemies present, the script disables. Though it shows the the script is disabled, it continues to fire rounds. Does anyone know why this is?

Here is the script:

var bullet : Transform;

var canshoot : boolean;

var Tank : Transform;

InvokeRepeating("RPS", 1, 5);
function RPS () {
if(canshoot == true){
audio.Play();
Instantiate(bullet, transform.position, transform.rotation);
Tank.animation.Play();
}
}

InvokeRepeating() is not disabled when a game object is disabled. Not sure how you want to handle this. Maybe you can add this to your script:

function OnDisable () {
	canshoot = false;
}