Advertisement
Guest User

DJRambo Fireworks Simple Script

a guest
Mar 31st, 2016
1,448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.47 KB | None | 0 0
  1. /* Fireworks System Made By: DJRambo */
  2.  
  3. // INCLUDES
  4. #include <a_samp>
  5. #include <zcmd>
  6. #include <foreach>
  7.  
  8. // DEFINES
  9. #define RocketHeight 75//Height Firework
  10. #define RocketSpread 50//
  11. #define MAX_LAUNCH 50//Max Launch on 1 time
  12. #define MAX_FIREWORKS 20 //Max Firework
  13. #define COLOR_GREY 0xAFAFAFAA
  14. #define COLOR_GREEN 0x33AA33AA
  15. #define COLOR_RED 0xAA3333AA
  16. #define COLOR_YELLOW 0xFFFF00AA
  17. #define COLOR_WHITE 0xFFFFFFAA
  18. #define COLOR_BLUE 0x0000BBAA
  19. #define COLOR_LIGHTBLUE 0x33CCFFAA
  20. #define COLOR_ORANGE 0xFF9900AA
  21. #define COLOR_RED 0xAA3333AA
  22. #define COLOR_LIME 0x10F441AA
  23. #define COLOR_MAGENTA 0xFF00FFFF
  24. #define COLOR_NAVY 0x000080AA
  25. #define COLOR_AQUA 0xF0F8FFAA
  26. #define COLOR_CRIMSON 0xDC143CAA
  27. #define COLOR_FLBLUE 0x6495EDAA
  28. #define COLOR_BISQUE 0xFFE4C4AA
  29. #define COLOR_BLACK 0x000000AA
  30. #define COLOR_CHARTREUSE 0x7FFF00AA
  31. #define COLOR_BROWN 0XA52A2AAA
  32. #define COLOR_CORAL 0xFF7F50AA
  33. #define COLOR_GOLD 0xB8860BAA
  34. #define COLOR_GREENYELLOW 0xADFF2FAA
  35. #define COLOR_INDIGO 0x4B00B0AA
  36. #define COLOR_IVORY 0xFFFF82AA
  37. #define COLOR_LAWNGREEN 0x7CFC00AA
  38. #define COLOR_SEAGREEN 0x20B2AAAA
  39. #define COLOR_LIMEGREEN 0x32CD32AA
  40. #define COLOR_MIDNIGHTBLUE 0X191970AA
  41. #define COLOR_MAROON 0x800000AA
  42. #define COLOR_OLIVE 0x808000AA
  43. #define COLOR_ORANGERED 0xFF4500AA
  44. #define COLOR_PINK 0xFFC0CBAA
  45. #define COLOR_SPRINGGREEN 0x00FF7FAA
  46. #define COLOR_TOMATO 0xFF6347AA
  47. #define COLOR_YELLOWGREEN 0x9ACD32AA
  48. #define COLOR_MEDIUMAQUA 0x83BFBFAA
  49. #define COLOR_MEDIUMMAGENTA 0x8B008BAA
  50.  
  51. stock GetPlayerNameEx(playerid)
  52. {
  53. new pName[25];
  54. GetPlayerName(playerid, pName, sizeof(pName));
  55. return pName;
  56. }
  57.  
  58. // Fireworks
  59. new Rocket[MAX_LAUNCH];//Max Fireworks allowed.
  60. new RocketLight[MAX_LAUNCH];//The light of the firework.
  61. new RocketSmoke[MAX_LAUNCH];//The smoke of the firework.
  62. new RocketExplosions[MAX_LAUNCH];//THE EXPLOSION!
  63. new Float:Frx[MAX_LAUNCH];//X
  64. new Float:Fry[MAX_LAUNCH];//Y
  65. new Float:Frz[MAX_LAUNCH];//Z
  66. new Fired;// If the firework has launched.
  67. new FireworkTotal;// Total Fireworks.
  68.  
  69. //TIME TO GET CRAZY!!
  70. // Firework's Variable.
  71. //This variable will destroy the object if the object already is in the sky and explode!
  72. forward Firework(i);
  73. public Firework(i)
  74. {
  75. new Float:x, Float:y, Float:z;
  76. x = Frx[i];
  77. y = Fry[i];
  78. z = Frz[i];
  79. z += RocketHeight;
  80. if (RocketExplosions[i] == 0)
  81. {
  82. DestroyObject(Rocket[i]);//This creates the firework.
  83. DestroyObject(RocketLight[i]);//This creates the firework's light.
  84. DestroyObject(RocketSmoke[i]);//This is the smoke of the firework.
  85. CreateExplosion(x ,y, z, 4, 10);
  86. CreateExplosion(x ,y, z, 5, 10);
  87. CreateExplosion(x ,y, z, 6, 10);
  88. }
  89. else if (RocketExplosions[i] >= MAX_FIREWORKS)
  90. {
  91. for (new j = 0; j <= RocketSpread; j++)
  92. {
  93. CreateExplosion(x + float(j - (RocketSpread / 2)), y, z, 7, 10);//EXPLOSION!
  94. CreateExplosion(x, y + float(j - (RocketSpread / 2)), z, 7, 10);//EXPLOSION!
  95. CreateExplosion(x, y, z + float(j - (RocketSpread / 2)), 7, 10);//EXPLOSION!
  96. }
  97. RocketExplosions[i] = -1;
  98. FireworkTotal = 0;//Make Firework back to 0
  99. Fired = 0;//Make Fired back to 0
  100. return 1;
  101. }
  102. else
  103. {
  104. x += float(random(RocketSpread) - (RocketSpread / 2));//EXPLOSIONS!
  105. y += float(random(RocketSpread) - (RocketSpread / 2));//EXPLOSIONS!
  106. z += float(random(RocketSpread) - (RocketSpread / 2));//EXPLOSIONS!
  107. CreateExplosion(x, y, z, 7, 10);
  108. }
  109. RocketExplosions[i]++;//EXPLOSIONS!
  110. SetTimerEx("Firework", 250, 0, "i", i);//TIMER BUDDY! :)
  111. return 1;
  112. }
  113.  
  114.  
  115. //COMMANDS
  116. CMD:placefirework(playerid, params[])
  117. {
  118. if(isnull(params))
  119. {
  120. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /placefirework [numbers of fireworks]");//SCM
  121. SendClientMessage(playerid, COLOR_GREY, "place , launch");//SCM
  122. return 1;
  123. }
  124. if(strcmp(params, "place", true) == 0 )
  125. {
  126. if(FireworkTotal == MAX_LAUNCH)//Detects the maximum fireworks.
  127. {
  128. SendClientMessage(playerid, COLOR_WHITE, "You have reached maximum number of fireworks!");
  129. return 1;
  130. }
  131. if(Fired == 1)//Detects if the fireworks explode.
  132. {
  133. SendClientMessage(playerid, COLOR_WHITE, "Wait till your fireworks are done before placing new ones!");
  134. return 1;
  135. }
  136. new string[128];
  137. format(string, sizeof(string), "%s has placed a special firework.", GetPlayerNameEx(playerid));
  138. new Float:x, Float:y, Float:z, Float:a;
  139. GetPlayerPos(playerid, x, y, z);
  140. foreach(Player, i)
  141. {
  142. if(IsPlayerInRangeOfPoint(i, 30, x, y, z)) {
  143. SendClientMessage(i, COLOR_YELLOW, string);
  144. }
  145. }
  146. GetPlayerFacingAngle(playerid, a);
  147. x += (2 * floatsin(-a, degrees));
  148. y += (2 * floatcos(-a, degrees));
  149. Rocket[FireworkTotal] = CreateObject(3786, x, y, z, 0, 90, 0);//Just creating rocket
  150. RocketLight[FireworkTotal] = CreateObject(354, x, y, z + 1, 0, 90, 0);//Creating Firework light
  151. RocketSmoke[FireworkTotal] = CreateObject(18716, x, y, z - 4, 0, 0, 0);//Creating firework smoke
  152. Frx[FireworkTotal] = x;
  153. Fry[FireworkTotal] = y;
  154. Frz[FireworkTotal] = z;
  155. RocketExplosions[FireworkTotal] = 0;
  156. FireworkTotal++;
  157. }
  158. else if(strcmp(params, "launch", true) == 0 )
  159. {
  160. if(FireworkTotal == 0)
  161. {
  162. SendClientMessage(playerid, COLOR_WHITE, "You dont have any fireworks!");
  163. return 1;
  164. }
  165. if(Fired == 1)
  166. {
  167. SendClientMessage(playerid, COLOR_WHITE, "You have already fired your fireworks!");
  168. return 1;
  169. }
  170. for(new i = 0; i < FireworkTotal; i++)
  171. {
  172. CreateExplosion(Frx[i] ,Fry[i], Frz[i], 12, 5);
  173. new time = MoveObject(Rocket[i], Frx[i] ,Fry[i], Frz[i] + RocketHeight, 10);// Move The object to the skys
  174. MoveObject(RocketLight[i], Frx[i] ,Fry[i], Frz[i] + 2 + RocketHeight, 10);// Move The object to the skys
  175. MoveObject(RocketSmoke[i], Frx[i] ,Fry[i], Frz[i] + RocketHeight, 10);// Move The object to the skys
  176. SetTimerEx("Firework", time, 0, "i", i);
  177. }
  178. Fired = 1;
  179. }
  180. return 1;
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement