The bomb keeps exploding in an endless loop every so often.
#1

pawn Код:
//Bomb
forward BombTimer();
forward BombTimer2();
forward BombSiteBdiffuse();
forward Difusingbomba();
new bool: BombArmed[MAX_PLAYERS];
new bool: BombArmed2[MAX_PLAYERS];

new BombTime;
new BombTime2;
new Difusing;
new BombSiteB;

new BombObject1;
new BombObject2;

new bomba;
new bombb;

public OnGameModeInit()
{
    //BombA
  bomba = CreateDynamicPickup(1254, 2, -954.4540,2956.6855,192.7991,0,0,-1,100.0);
  bombb = CreateDynamicPickup(1254, 2, -891.3544,2945.1326,192.5893,0,0,-1,100.0);
    return 1;
}

public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
  if (pickupid == bomba)
  {
   if(BombArmed[playerid] == false && DM21[playerid] == true)
   {
     SendClientMessage(playerid, 0x0066FFAA, "Bomb Planted (exploding in 30 seconds).");
     ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
     BombTime = SetTimer("BombTimer",30000,true);
     BombObject1 = CreateDynamicObject(1252, -954.4540,2956.6855,192.7991,0.0000,0.0000,0.0000,0,0,-1);
     for(new i = 0; i < MAX_PLAYERS; i++)
     {
      BombArmed = true;
     }
   }
   else if(BombArmed[playerid] == true && DM21[playerid] == true)
   {
     SendClientMessage(playerid, 0x0066FFAA, "The bomb is armed (30 Seconds) Do not let it become diffused!");
   }
   else if(BombArmed[playerid] == true && DM20[playerid] == true)
   {
     ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
     Difusing = SetTimer("Difusingbomba",5000,true);
     for(new i = 0; i < MAX_PLAYERS; i++)
     {
      BombArmed = false;
     }
   }
   else if(BombArmed[playerid] == false && DM20[playerid] == true)
   {
     SendClientMessage(playerid, 0x0066FFAA, "This is bombsite A. You must not let the terrorists arm it");
   }
   return 1;
  }
  if (pickupid == bombb)
  {
   if(BombArmed2[playerid] == false && DM21[playerid] == true)
   {
     SendClientMessage(playerid, 0x0066FFAA, "Bomb Planted (exploding in 30 seconds).");
     ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
     BombTime2 = SetTimer("BombTimer2",30000,true);
     BombObject2 = CreateDynamicObject(1252, -891.3544,2945.1326,192.5893,0.0000,0.0000,0.0000,0,0,-1);
     for(new i = 0; i < MAX_PLAYERS; i++)
     {
      BombArmed2 = true;
     }
   }
   else if(BombArmed2[playerid] == true && DM21[playerid] == true)
   {
     SendClientMessage(playerid, 0x0066FFAA, "The bomb is armed (30 Seconds) Do not let it become diffused!");
   }
   else if(BombArmed2[playerid] == true && DM20[playerid] == true)
   {
     ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
     BombSiteB = SetTimer("BombSiteBdiffuse",5000,true);
     for(new i = 0; i < MAX_PLAYERS; i++)
     {
      BombArmed2 = false;
     }
   }
   else if(BombArmed2[playerid] == false && DM20[playerid] == true)
   {
     SendClientMessage(playerid, 0x0066FFAA, "This is bombsite B. You must not let the terrorists arm it");
   }
   return 1;
  }
    return 0;
}

public BombTimer()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
   if(BombArmed == true)
   {
     DestroyDynamicObject(BombObject1);
     CreateExplosion(-954.4540,2956.6855,192.7991, 7, 50);
     SendClientMessage(i, COLOR_GREY, "Bomb A exploded.");
     BombArmed = false;
     KillTimer(BombTime);
   }
  }
  return 1;
}

public BombTimer2()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
   if(BombArmed2 == true)
   {
     DestroyDynamicObject(BombObject2);
     CreateExplosion(-891.3544,2945.1326,192.5893, 7, 50);
     SendClientMessage(i, COLOR_GREY, "Bomb B exploded.");
     BombArmed2 = false;
     KillTimer(BombTime2);
   }
  }
  return 1;
}

public Difusingbomba()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
   if(BombArmed == true)
   {
     BombArmed = false;
     DestroyDynamicObject(BombObject1);
     SendClientMessage(i, COLOR_GREEN, "Bomb A Diffused.");
     KillTimer(BombTime);
     KillTimer(Difusing);
   }
  }
  return 1;
}

public BombSiteBdiffuse()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
   if(BombArmed2 == true)
   {
     DestroyDynamicObject(BombObject2);
     SendClientMessage(i, COLOR_GREEN, "Bomb B Diffused.");
     BombArmed2 = false;
     KillTimer(BombTime2);
     KillTimer(BombSiteB);
   }
  }
  return 1;
}
Reply
#2

That's alot of code to cover, try to narrow it down a bit, Focus on Bomb A for example

Try putting in a break; after it executes the explosion code, see if that works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)