Prevent player from activating same checkpoint again.

So I have a checkpoint system I’ve created based on the following criteria:

If player is within zone of the checkpoint and has atleast 1 matchstick then they can activate the checkpoint via key press of F key.

If player is within zone of the checkpoint and has zero matchsticks then they will be prevented from activating the checkpoint via key press of F key.

In this script the player is able to go to multiple checkpoints which will activate individually changing the player’s respawn location.

The problem I’m facing is setting the checkpoints so if a player has say 3 matches. if they activate the checkpoint, there is no prevention to them activating the same checkpoint multiple times.

What I want to happen is if the player activates the checkpoint then if the player tries to activate the same checkpoint they will not lose any matches and will be prevented from inputting key presses on this particular checkpoint until they activate a different checkpoint and then they will be once again be able to activate the original checkpoint.

Checkpoint script

public class Checkpoint : MonoBehaviour {

    public LevelManager levelManager;
    public static int _currentMatches = 3;
    public bool inZone = false;

    // Use this for initialization
    void Start()
    { levelManager = FindObjectOfType<LevelManager>(); }

    // Update is called once per frame
    void Update ()
    { if (Input.GetKeyDown(KeyCode.F) && inZone)
        { if (_currentMatches >= 1)
            { levelManager.currentCheckpoint = gameObject;
              Debug.Log("Activated Checkpoint" + transform.position); //Add gui label text display "CheckPoint activated"
              _currentMatches--;
                Debug.Log("You have this many matches left");
                print(_currentMatches);
            }

          else if (_currentMatches <=0)
            { _currentMatches = 0;
             Debug.Log("You have no matches go collect matches"); }}} // put code for when player has no matches - GUI Lavel text display "Find Matches to activate checkpoint"
    
    public void OnTriggerEnter(Collider other)  
    { if (other.name == "Player")
        { inZone = true;
         /* Debug.Log("In checkpoint zone press f to activate");*/ }}

    public void OnTriggerExit(Collider other)
    { if (other.name == "Player")
        { inZone = false;
          /*Debug.Log("I'm out of checkpoint zone");*/ }}

    public void AddMatches (int _matchesAmount) //haven't setup adding matches to current total as of yet -- Only updates checkpoint (1) never updates original checkpoint
    { _currentMatches += _matchesAmount;
        Debug.Log("You have added this match to your amount");
        print(_matchesAmount);
        Debug.Log("You have now this amount of matches");
        print(_currentMatches); }

    public void CheckCheckPoint()
    {
        // If player is in a checkpoint make it so they can't activate that particular checkpoint again until they've changed to a new checkpoint.
    }

}

Level Manager Script - My checkpoint script communicates with this script for changing the respawn location

using UnityEngine;
using System.Collections;
using UnityStandardAssets.Characters.FirstPerson;

public class LevelManager : MonoBehaviour {

    public GameObject currentCheckpoint;   
    private FirstPersonController player;

    void Start ()
    { player = FindObjectOfType<FirstPersonController>(); }
	
    public void RespawnPlayer()
    { Debug.Log("Respawned Player");
      player.transform.position = currentCheckpoint.transform.position; }}

Does anyone have an idea as to how I can do this?

You could verify if your current checkpoint saved instance is differente as the one the player is trying to activate.

if (Input.GetKeyDown(KeyCode.F) && inZone && levelManager.currentCheckpoint != gameObject)
         { if (_currentMatches >= 1)
             { levelManager.currentCheckpoint = gameObject;
               Debug.Log("Activated Checkpoint" + transform.position); //Add gui label text display "CheckPoint activated"
               _currentMatches--;
                 Debug.Log("You have this many matches left");
                 print(_currentMatches);
             }
 
           else if (_currentMatches <=0)
             { _currentMatches = 0;
              Debug.Log("You have no matches go collect matches"); }}} // put code for when player has no matches - GUI Lavel text display "Find Matches to activate checkpoint"

Something like this should work.

Probably something like

    private bool isCheckpointActive = true;
    
    void Update () { 
        if (Input.GetKeyDown(KeyCode.F) && inZone && isCheckpointActive)
        {
            if (_currentMatches >= 1)
             { 
                isCheckpointActive = false;

                //rest of your code here
             }
        }
}