How Do I Make My Enemy Hit And Not Drain My Players Health (Please Help Fast!)

Here is the code it works but i want 2 to 3 seconds where the enemy can’t attack my player after i get hit
Problem Located At The Last Four Lines.

#pragma strict
var curHp : float = 100.0;
var maxHp : int = 100;
var currentThirst : float = 100.0;
var maxThirst : int = 100;
var currentHunger : float = 100.0;
var maxHunger : int = 100;
var lastPositionY : float = 0f;
var fallDistance : float = 0f;
var player : Transform;
private var controller : CharacterController;
private var barLength = 0.0;
function Start()
{
    barLength = Screen.width / 8;
}
function Update()
{
    if(curHp <= 0)
    {
        CharacterDeath();
    }

    /* THIRST CONTROL SECTION*/

    //Normal thirst degredation
    if(currentThirst >= 0)
    {
        currentThirst -= Time.deltaTime / 5;
    }

    if(currentThirst <= 0)
    {
        currentThirst = 0;
    }

    if(currentThirst >= maxThirst)
    {
        currentThirst = maxThirst;
    }

    /* HUNGER CONTROL SECTION*/
        if(currentHunger >= 0)
    {
        currentHunger -= Time.deltaTime / 8;
    }

    if(currentHunger <= 0)
    {
        currentHunger = 0;
    }

    if(currentHunger >= maxHp)
    {
        curHp = maxHunger;
    }

    /* DAMAGE CONTROL SECTION*/
    if(currentHunger <= 0 && (currentThirst <= 0))
    {
        curHp -= Time.deltaTime / 4;
        if (currentHunger <= 0){
   
            print ("You Died"); }
    }

    else
    {
        if(currentHunger <= 0 || currentThirst <= 0)
        {
            curHp -= Time.deltaTime / 8;
        }
    }
}
function CharacterDeath()
{
    Application.LoadLevel("SimpleMenu");
}
function OnGUI()
{
    //Icons
    GUI.Box(new Rect(5, 30, 50, 23), "Health");
    GUI.Box(new Rect(5, 55, 50, 23), "Thirst");
    GUI.Box(new Rect(5, 80, 50, 23), "Hunger");

    //Health / Hunger / Thirst bars
    GUI.Box(new Rect(55, 30, barLength, 23), curHp.ToString("0") + "/" + maxHp);
    GUI.Box(new Rect(55, 55, barLength, 23), currentThirst.ToString("0") + "/" + maxThirst);
    GUI.Box(new Rect(55, 80, barLength, 23), currentHunger.ToString("0") + "/" + maxHunger);

}
function OnTriggerEnter (other : Collider) {
    if(other.gameObject == ("CocconutCol") && currentHunger <= 90.0){

        currentHunger += 10;
        Destroy (other.gameObject.transform.parent.gameObject);
}
}
function OnControllerColliderHit(hit : ControllerColliderHit){
     if (hit.gameObject.CompareTag("Enemy")){

         curHp = curHp - 5;
     }
}

Stop asking for “help fast”. It’s annoying.

Clearly state what the problem is (ie - what is not working).

So you know where the problem is? What is your question anyway? You don’t know how to write the code?

well i don’t really know how to make 2 or 3 seconds where the enemy can’t attack

it works but the enemy just drains my health