Reload Weapon Script

I dont know how to fix this,i want when currentammo and currentclip = 0 gun stop shooting,but gun stop shooting when currentclip = 0 and current ammo = 30 :frowning:
there’s the script:

var CurrentAmmo : int = 0;
var CurrentClip : int = 6;
var AmmoPerClip : int = 30;
var EmptySound : AudioClip;
var ReloadSound : AudioClip;
var Spawn : Transform;
var BulletSpeed : float = 1000;
var ReloadTime : float = 2;
var IsFullAuto = false;
@script HideInInspector
static var ReloadTTime : float = 2;
static var IsReloading = false;
private var CanFire = true;
var FireRate = 0.1;
var DifferentAmmo : float;
var Range = 100;

var MuzzleFlash : ParticleEmitter;
var Muzzlelight : GameObject;
var MuzzleTimer : float = 0.0f;
var MuzzleCooler : float = 0.1;

var MaxRandomness : float = 1.0f;
var MinRandomness : float = 1.0f;

var BulletBulletHole : Transform;


var DirtImpact     : Transform;
var MetalImpact    : Transform;
var WoodImpact     : Transform;
var ConcreteImpact : Transform;
var GlassImpact    : Transform;

var shootPosition : Vector3;




function Start () 
{
    Screen.showCursor = false;
    CurrentAmmo = AmmoPerClip;
    ReloadTTime = ReloadTime;
}

function Update () 
{   
    if(CurrentClip < 0)
    {
     CurrentClip = 0;
    }

   
   
   
   if(MuzzleTimer > 0 && MuzzleFlash)
   {
     MuzzleFlash.emit = false;
     Muzzlelight.active = false;
   }
   
   MuzzleTimer -= Time.deltaTime;
   MuzzleTimer = MuzzleCooler; 
  
  
  if(Input.GetKey(KeyCode.X))
  {
     IsFullAuto = true;
  }
  if ( Input.GetKey(KeyCode.X) == true && Input.GetKey(KeyCode.Z))
  {     
       IsFullAuto = false;  
  }




    
    
  
  if(IsFullAuto == false)
  {
   if(Input.GetButtonDown("Fire1"))
   {
     if(CurrentAmmo > 0)
     {
       BroadcastMessage("FireAnim");
       Fire();
     }
   }
  }
  
  else
  {
     if(Input.GetButton("Fire1"))
   {
     if(CurrentAmmo > 0)
     {
       BroadcastMessage("FireAnim");
       Fire();
     }
   }
  }
 
  if(Input.GetKey(KeyCode.R) && CurrentAmmo == 0 && !IsReloading)
  {
    Reload();
  }
  

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

}

function Fire()
{
  
  
  if(CanFire == true && IsReloading == false)
  {    
   
    var hit : RaycastHit;
    var fwd = Spawn.TransformDirection(Vector3.left);
    
    Debug.DrawRay(Spawn.position,fwd);
    
       if(MuzzleFlash)
     {
        MuzzleFlash.Emit();
        Muzzlelight.SetActiveRecursively(true);
     }
    
    BroadcastMessage("FireAnim");
    CanFire = false;
    yield WaitForSeconds(FireRate);
    CanFire = true;
    CurrentAmmo --;
    audio.Play();
    

    
    
   
    
    
    if(Physics.Raycast(Spawn.position,fwd,hit,Range))
    {
    
      if(hit.collider.tag == "Dirt")
      {
         Instantiate(DirtImpact,hit.point,Quaternion.FromToRotation(Vector3.up,hit.normal));
         Instantiate(BulletBulletHole,hit.point,Quaternion.FromToRotation(Vector3.up,hit.normal));    
      }  
      if(hit.collider.tag == "Concrete")
      {
          Instantiate(ConcreteImpact,hit.point,Quaternion.FromToRotation(Vector3.up,hit.normal));
          Instantiate(BulletBulletHole,hit.point,Quaternion.FromToRotation(Vector3.up,hit.normal));
      }   
      if(hit.collider.tag == "Metal")
      {
         Instantiate(MetalImpact,hit.point,Quaternion.FromToRotation(Vector3.up,hit.normal));
         Instantiate(BulletBulletHole,hit.point,Quaternion.FromToRotation(Vector3.up,hit.normal));
      }  
      if(hit.collider.tag == "Wood")
      {
         Instantiate(WoodImpact,hit.point,Quaternion.FromToRotation(Vector3.up,hit.normal));
         Instantiate(BulletBulletHole,hit.point,Quaternion.FromToRotation(Vector3.up,hit.normal));
      } 
      if(hit.collider.tag == "Glass")
      {
         Instantiate(GlassImpact,hit.point,Quaternion.FromToRotation(Vector3.up,hit.normal));        
      }
      
   
         
    }
  }
}

function Reload()
{
 
    IsReloading = true;    
    audio.PlayOneShot(ReloadSound);
    BroadcastMessage("ReloadAnim");
    yield WaitForSeconds(ReloadTime);
    IsReloading = false;
    CurrentAmmo = AmmoPerClip;
    CurrentClip -= 1;
      
}

if(CurrentClip >= 0)
{
BroadcastMessage(“FireAnim”);
Fire();
}

instead of

 if(CurrentAmmo > 0)
     {
       BroadcastMessage("FireAnim");
       Fire();
     }

:slight_smile: