Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Fireworks System Made By: DJRambo */
- // INCLUDES
- #include <a_samp>
- #include <zcmd>
- #include <foreach>
- // DEFINES
- #define RocketHeight 75//Height Firework
- #define RocketSpread 50//
- #define MAX_LAUNCH 50//Max Launch on 1 time
- #define MAX_FIREWORKS 20 //Max Firework
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_BLUE 0x0000BBAA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_LIME 0x10F441AA
- #define COLOR_MAGENTA 0xFF00FFFF
- #define COLOR_NAVY 0x000080AA
- #define COLOR_AQUA 0xF0F8FFAA
- #define COLOR_CRIMSON 0xDC143CAA
- #define COLOR_FLBLUE 0x6495EDAA
- #define COLOR_BISQUE 0xFFE4C4AA
- #define COLOR_BLACK 0x000000AA
- #define COLOR_CHARTREUSE 0x7FFF00AA
- #define COLOR_BROWN 0XA52A2AAA
- #define COLOR_CORAL 0xFF7F50AA
- #define COLOR_GOLD 0xB8860BAA
- #define COLOR_GREENYELLOW 0xADFF2FAA
- #define COLOR_INDIGO 0x4B00B0AA
- #define COLOR_IVORY 0xFFFF82AA
- #define COLOR_LAWNGREEN 0x7CFC00AA
- #define COLOR_SEAGREEN 0x20B2AAAA
- #define COLOR_LIMEGREEN 0x32CD32AA
- #define COLOR_MIDNIGHTBLUE 0X191970AA
- #define COLOR_MAROON 0x800000AA
- #define COLOR_OLIVE 0x808000AA
- #define COLOR_ORANGERED 0xFF4500AA
- #define COLOR_PINK 0xFFC0CBAA
- #define COLOR_SPRINGGREEN 0x00FF7FAA
- #define COLOR_TOMATO 0xFF6347AA
- #define COLOR_YELLOWGREEN 0x9ACD32AA
- #define COLOR_MEDIUMAQUA 0x83BFBFAA
- #define COLOR_MEDIUMMAGENTA 0x8B008BAA
- stock GetPlayerNameEx(playerid)
- {
- new pName[25];
- GetPlayerName(playerid, pName, sizeof(pName));
- return pName;
- }
- // Fireworks
- new Rocket[MAX_LAUNCH];//Max Fireworks allowed.
- new RocketLight[MAX_LAUNCH];//The light of the firework.
- new RocketSmoke[MAX_LAUNCH];//The smoke of the firework.
- new RocketExplosions[MAX_LAUNCH];//THE EXPLOSION!
- new Float:Frx[MAX_LAUNCH];//X
- new Float:Fry[MAX_LAUNCH];//Y
- new Float:Frz[MAX_LAUNCH];//Z
- new Fired;// If the firework has launched.
- new FireworkTotal;// Total Fireworks.
- //TIME TO GET CRAZY!!
- // Firework's Variable.
- //This variable will destroy the object if the object already is in the sky and explode!
- 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)
- {
- DestroyObject(Rocket[i]);//This creates the firework.
- DestroyObject(RocketLight[i]);//This creates the firework's light.
- DestroyObject(RocketSmoke[i]);//This is the smoke of the firework.
- 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);//EXPLOSION!
- CreateExplosion(x, y + float(j - (RocketSpread / 2)), z, 7, 10);//EXPLOSION!
- CreateExplosion(x, y, z + float(j - (RocketSpread / 2)), 7, 10);//EXPLOSION!
- }
- 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));//EXPLOSIONS!
- y += float(random(RocketSpread) - (RocketSpread / 2));//EXPLOSIONS!
- z += float(random(RocketSpread) - (RocketSpread / 2));//EXPLOSIONS!
- CreateExplosion(x, y, z, 7, 10);
- }
- RocketExplosions[i]++;//EXPLOSIONS!
- SetTimerEx("Firework", 250, 0, "i", i);//TIMER BUDDY! :)
- return 1;
- }
- //COMMANDS
- CMD:placefirework(playerid, params[])
- {
- if(isnull(params))
- {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: /placefirework [numbers of fireworks]");//SCM
- SendClientMessage(playerid, COLOR_GREY, "place , launch");//SCM
- return 1;
- }
- if(strcmp(params, "place", true) == 0 )
- {
- if(FireworkTotal == MAX_LAUNCH)//Detects the maximum fireworks.
- {
- SendClientMessage(playerid, COLOR_WHITE, "You have reached maximum number of fireworks!");
- return 1;
- }
- if(Fired == 1)//Detects if the fireworks explode.
- {
- 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] = CreateObject(3786, x, y, z, 0, 90, 0);//Just creating rocket
- RocketLight[FireworkTotal] = CreateObject(354, x, y, z + 1, 0, 90, 0);//Creating Firework light
- RocketSmoke[FireworkTotal] = CreateObject(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 = MoveObject(Rocket[i], Frx[i] ,Fry[i], Frz[i] + RocketHeight, 10);// Move The object to the skys
- MoveObject(RocketLight[i], Frx[i] ,Fry[i], Frz[i] + 2 + RocketHeight, 10);// Move The object to the skys
- MoveObject(RocketSmoke[i], Frx[i] ,Fry[i], Frz[i] + RocketHeight, 10);// Move The object to the skys
- SetTimerEx("Firework", time, 0, "i", i);
- }
- Fired = 1;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement