Reloading Help

How would I write a script so that if the player has shot 8 raycasts (bullets) you cannot shoot any more until you have pressed r and waited for the reload animation to finish?

Create a variable that contains the amount of available shots. Then in the function where you allow the player player to shoot do something like this:

    var amountOfShots : int = 8;

function Update()

{

 if(Input.GetMouseButton(0) && amountOfShot > 0 )
{

//shoot

}

if(Input.GetButton("Reload"))
{
amountOfShots = 8;
}
}

var amountOfShots = 8;

function Update (){
if(Input.GetButtonDown("Fire1")){
    Shoot();
    }
if(Input.GetKeyDown("r")){
    amountOfShots = 8;
    }
}

var shootSound : AudioClip;
var bloodPrefab : Transform;
var sparksPrefab : Transform;
var hit : RaycastHit;
var range = 500;

function Shoot (){
    if(amountOfShots > 0){
        amountOfShots--;
        if(shootSound){
        audio.PlayOneShot(shootSound);
    }
if(Physics.Raycast(transform.position, transform.forward, hit, range)){
    var rot = Quaternion.FromToRotation(Vector3.up, hit.normal);

    if(hit.collider.tag == "Enemy"){
        if(bloodPrefab){
            Instantiate(bloodPrefab, hit.point, rot);
        }
            hit.collider.gameObject.SendMessage("ApplyDamage",SendMessageOptions.DontRequireReceiver);
        }else{
        if(sparksPrefab){
            Instantiate(sparksPrefab, hit.point, rot);
            }
        }
    }
}
}

That was just a very brief concept explanation. Very un-detailed, but should give you the idea.