Disable/enable mouseclick

How do I make the player click with LMB 7 times to disable LMB and then they have to press “r” to enable it again?
(I’m making guns)

Is this what you are looking for?

var Enabled : boolean;
private var counter : int;

function Start () {
Enabled = true;
}

function Update () {

if(Input.GetKeyUp(KeyCode.R)){
Enabled = true;
}

if(Input.GetKeyUp(KeyCode.Mouse0)){
counter += 1;
}

if(counter == 7){
Enabled = false;
counter = 0;
}

}

basicaly somthing like this:

bool lmbDisabled=false;
int counter=0;

void Update() 
{    
    if (Input.GetMouseButtonUp(1)&&!lmbDisabled)
    {
        counter++;
        if(counter>=7)
        {
            lmbDisabled=true;
            counter=0;
        {
    }
    if (Input.GetKeyUp(KeyCode.R))
        lmbDisabled=false;
}