// Define
#define RocketHeight 50//Height Firework
#define RocketSpread 30//
#define MAX_LAUNCH 30//Max Launch on 1 time
#define MAX_FIREWORKS 500 //Max Firework
// New Firework
new Rocket[MAX_LAUNCH];//Max Firework
new RocketLight[MAX_LAUNCH];//Firework light
new RocketSmoke[MAX_LAUNCH];//Firework smoke
new RocketExplosions[MAX_LAUNCH];//Explosions on firework
new Float:Frx[MAX_LAUNCH];//Float X
new Float:Fry[MAX_LAUNCH];//Float Y
new Float:Frz[MAX_LAUNCH];//Float Z
new FireworkTotal;// Total Firework
new Fired;// If firework launched
// Variable of firework this variable will destroy object if object already on the sky and make explosions
forward Firework(i);
public Firework(i)
{
  new Float:x, Float:y, Float:z;
  x = Frx[i];
  y = Fry[i];
  z = Frz[i];
  z += RocketHeight;
  if (RocketExplosions[i] == 0)
  {
    DestroyDynamicObject(Rocket[i]);//It Will Create The Rocket
    DestroyDynamicObject(RocketLight[i]);//It Will Create The Light For The Rocket
    DestroyDynamicObject(RocketSmoke[i]);// And This for the smoke
    CreateExplosion(x ,y, z, 4, 10);
    CreateExplosion(x ,y, z, 5, 10);
    CreateExplosion(x ,y, z, 6, 10);
  }
  else if (RocketExplosions[i] >= MAX_FIREWORKS)
  {
    for (new j = 0; j <= RocketSpread; j++)
    {
      CreateExplosion(x + float(j - (RocketSpread / 2)), y, z, 7, 10);// Its for the explosions
      CreateExplosion(x, y + float(j - (RocketSpread / 2)), z, 7, 10);//Same
      CreateExplosion(x, y, z + float(j - (RocketSpread / 2)), 7, 10);//Same
    }
    RocketExplosions[i] = -1;
    FireworkTotal = 0;//Make Firework back to 0
    Fired = 0;//Make Fired back to 0
    return 1;
  }
  else
  {
    x += float(random(RocketSpread) - (RocketSpread / 2));//Random Explosions
    y += float(random(RocketSpread) - (RocketSpread / 2));//Random Explosions
    z += float(random(RocketSpread) - (RocketSpread / 2));//Random Explosions
    CreateExplosion(x, y, z, 7, 10);
  }
  RocketExplosions[i]++;//Make Explosions
  SetTimerEx("Firework", 250, 0, "i", i);//Timer For Explosions
  return 1;
}
CMD:firework(playerid, params[])
{
  if(isnull(params))
  {
    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /firework [name]");//SCM
    SendClientMessage(playerid, COLOR_GREY, "place , launch");//SCM
    return 1;
  }
  if(strcmp(params, "place", true) == 0 )//it will detect if you type place
  {
      if(FireworkTotal == MAX_LAUNCH)//will detect if firework is reach maximum firework
      {
        SendClientMessage(playerid, COLOR_WHITE, "You have reached maximum number of fireworks!");
        return 1;
      }
      if(Fired == 1)//Will detect if firework on explosions
      {
        SendClientMessage(playerid, COLOR_WHITE, "Wait till your fireworks are done before placing new ones!");
        return 1;
      }
      new string[128];
      format(string, sizeof(string), "%s has placed a special firework.", GetPlayerNameEx(playerid));
      new Float:x, Float:y, Float:z, Float:a;
      GetPlayerPos(playerid, x, y, z);
      foreach(Player, i)
      {
        if(IsPlayerInRangeOfPoint(i, 30, x, y, z)) {
          SendClientMessage(i, COLOR_YELLOW, string);
        }
      }
      GetPlayerFacingAngle(playerid, a);
      x += (2 * floatsin(-a, degrees));
      y += (2 * floatcos(-a, degrees));
      Rocket[FireworkTotal] = CreateDynamicObject(3786, x, y, z, 0, 90, 0);//Just creating rocket
      RocketLight[FireworkTotal] = CreateDynamicObject(354, x, y, z + 1, 0, 90, 0);//Creating Firework light
      RocketSmoke[FireworkTotal] = CreateDynamicObject(18716, x, y, z - 4, 0, 0, 0);//Creating firework smoke
      Frx[FireworkTotal] = x;
      Fry[FireworkTotal] = y;
      Frz[FireworkTotal] = z;
      RocketExplosions[FireworkTotal] = 0;
      FireworkTotal++;
  }
  else if(strcmp(params, "launch", true) == 0 )
  {
    if(FireworkTotal == 0)
    {
      SendClientMessage(playerid, COLOR_WHITE, "You dont have any fireworks!");
      return 1;
    }
    if(Fired == 1)
    {
      SendClientMessage(playerid, COLOR_WHITE, "You have already fired your fireworks!");
      return 1;
    }
    for(new i = 0; i < FireworkTotal; i++)
    {
      CreateExplosion(Frx[i] ,Fry[i], Frz[i], 12, 5);
      new time = MoveDynamicObject(Rocket[i], Frx[i] ,Fry[i], Frz[i] + RocketHeight, 10);// Move The object to the skys
      MoveDynamicObject(RocketLight[i], Frx[i] ,Fry[i], Frz[i] + 2 + RocketHeight, 10);//Same
      MoveDynamicObject(RocketSmoke[i], Frx[i] ,Fry[i], Frz[i] + RocketHeight, 10);//Same
      SetTimerEx("Firework", time, 0, "i", i);
    }
    Fired = 1;
  }
    return 1;
}
CreateExplosion(x ,y, z, 4, 10);
    CreateExplosion(x ,y, z, 5, 10);
    CreateExplosion(x ,y, z, 6, 10);
  }
  else if (RocketExplosions[i] >= MAX_FIREWORKS)
  {
    for (new j = 0; j <= RocketSpread; j++)
    {
Liar was fuck, Copied script.
okey explain this: pawn Код:
|
CreateExplosion will create the explosions
rocketexplosions mean is, output of the firework |