Advertisement
Guest User

fireworks samp

a guest
Jan 6th, 2013
647
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.56 KB | None | 0 0
  1. /////////////////////////////////////
  2. // Firework //
  3. // By: Petricko //
  4. /////////////////////////////////////
  5. #include <a_samp>
  6.  
  7. forward Plamen(playerid);
  8. forward Lansiranje();
  9. forward Pucanje1();
  10. forward Pucanje2();
  11. forward StvaranjeBoja();
  12. forward KrajVatrometa();
  13. forward KrajVatrometa1();
  14. forward Pucanje3();
  15.  
  16. #define TrajanjeVatrometa 20000
  17. #define TrajanjeVatrometa1 20000
  18.  
  19. new raketa, jtpack, dim, KrajPucanja, Crvena, Crvena1, Bela, Bela1, Boja, Kutija, KrajPucanja1;
  20.  
  21. public OnFilterScriptInit()
  22. {
  23. jtpack = CreateObject(18699, 0, 0,-100.0, 0.00, 0.00, 0.00);
  24. dim = CreateObject(18707, 0, 0,-100.0, 0.00, 0.00, 0.00);
  25. print("\n----------------------------");
  26. print(" Firework");
  27. print(" By: Petricko");
  28. print("LOAD");
  29. print("----------------------------\n");
  30. return 1;
  31. }
  32.  
  33. stock Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  34. {
  35. new Float:a;
  36. GetPlayerPos(playerid, x, y, a);
  37. if (IsPlayerInAnyVehicle(playerid))
  38. GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  39. else
  40. GetPlayerFacingAngle(playerid, a);
  41. x += (distance * floatsin(-a, degrees));
  42. y += (distance * floatcos(-a, degrees));
  43. return a;
  44. }
  45.  
  46. public OnPlayerCommandText(playerid, cmdtext[])
  47. {
  48. if (strcmp("/fireworks", cmdtext, true, 10) == 0)
  49. {
  50. if(IsPlayerAdmin(playerid))
  51. {
  52. new Float: px, Float:py, Float:pz;
  53. GetPlayerPos(playerid, px, py, pz);
  54. GetXYInFrontOfPlayer(playerid, px, py, 2);
  55. raketa = CreateObject(2238, px+2, py, pz-0.5, 0.00, 0.00, 0.00);
  56. SendClientMessage(playerid, 0xFF0000FF, "Firework start...");
  57. SetTimer("Plamen",3000,0);
  58. SetWorldTime(00);
  59. return 1;
  60. }
  61. else
  62. {
  63. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}[EROR]{FFFFFF}You are not admin!");
  64. return 1;
  65. }
  66. }
  67.  
  68. if (strcmp("/fireworks1", cmdtext, true, 10) == 0)
  69. {
  70. if(IsPlayerAdmin(playerid))
  71. {
  72. new Float: px, Float:py, Float:pz;
  73. GetPlayerPos(playerid, px, py, pz);
  74. GetXYInFrontOfPlayer(playerid, px, py, 2);
  75. Kutija = CreateObject(3013, px+2, py, pz-0.5, 0.00, 0.00, 0.00);
  76. SendClientMessage(playerid, 0xFF0000FF, "Firework start...");
  77. SetTimer("StvaranjeBoja",3000,0);
  78. SetWorldTime(00);
  79. return 1;
  80. }
  81. else
  82. {
  83. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}[EROR]{FFFFFF}You are not admin!");
  84. return 1;
  85. }
  86. }
  87. return 0;
  88. }
  89.  
  90.  
  91. public Plamen(playerid)
  92. {
  93. AttachObjectToObject(jtpack, raketa, 0.0, 0.0, -2.05, 0.0, 0.0, 0.0, 1);
  94. SetTimer("Lansiranje",3000,0);
  95. return 1;
  96. }
  97.  
  98. public Lansiranje()
  99. {
  100. new Float:ox, Float:oy, Float:oz;
  101. GetObjectPos(raketa, ox, oy, oz);
  102. AttachObjectToObject(dim, raketa, 0.0, 0.0, -2.05, 0.0, 0.0, 0.0, 1);
  103. DestroyObject(jtpack);
  104. SetTimer("Pucanje1",3125,0);
  105. MoveObject(raketa, ox, oy, oz+25, 8.00);
  106. for(new i = 0; i < MAX_PLAYERS; i++)
  107. {
  108. if(IsPlayerInRangeOfPoint(i, 50.0 ,ox, oy, oz-25))
  109. {
  110. PlayAudioStreamForPlayer(i,"http://k003.kiwi6.com/hotlink/48v50pdgu9/1.mp3");
  111. }
  112. }
  113. return 1;
  114. }
  115.  
  116. public Pucanje1()
  117. {
  118. new rx = random(15), ry = random(15), rz = random(15),
  119. Float:ox, Float:oy, Float:oz;
  120. GetObjectPos(raketa, ox, oy, oz);
  121. DestroyObject(dim);
  122. CreateObject(18668, ox+rx, oy+ry, oz-rz, 0.00, 0.00, 0.00);//Crvena boja
  123. CreateObject(18668, ox-rx, oy-ry, oz-rz, 0.00, 0.00, 0.00);//Crvena boja
  124. CreateObject(18685, ox+rx, oy+ry, oz+rz, 0.00, 0.00, 0.00);//Explozija
  125. CreateObject(18685, ox-rx, oy-ry, oz+rz, 0.00, 0.00, 0.00);//Explozija
  126. Pucanje2();
  127. KrajPucanja = SetTimer("Pucanje1",300,0);
  128. SetTimer("KrajVatrometa",TrajanjeVatrometa,0);
  129. return 1;
  130. }
  131.  
  132. public Pucanje2()
  133. {
  134. new rx = random(15), ry = random(15), rz = random(15),
  135. Float:ox, Float:oy, Float:oz;
  136. GetObjectPos(raketa, ox, oy, oz);
  137. DestroyObject(Crvena);
  138. DestroyObject(Crvena1);
  139. DestroyObject(Bela);
  140. DestroyObject(Bela1);
  141. Crvena = CreateObject(1213, ox+rx, oy+ry, oz-rz, 0.00, 0.00, 0.00);//trep
  142. Crvena1 = CreateObject(1213, ox-rx, oy-ry, oz-rz, 0.00, 0.00, 0.00);//trep
  143. Bela = CreateObject(354, ox+rx, oy+ry, oz-rz, 0.00, 0.00, 0.00);//trep
  144. Bela1 = CreateObject(354, ox-rx, oy-ry, oz-rz, 0.00, 0.00, 0.00);//trep
  145. return 1;
  146. }
  147.  
  148. public KrajVatrometa()
  149. {
  150. KillTimer(KrajPucanja);
  151. DestroyObject(raketa);
  152. DestroyObject(Crvena);
  153. DestroyObject(Crvena1);
  154. DestroyObject(Bela);
  155. DestroyObject(Bela1);
  156. return 1;
  157. }
  158.  
  159. public StvaranjeBoja()
  160. {
  161. new Rand;
  162. new Float:ox, Float:oy, Float:oz;
  163. Rand = random(6);
  164. GetObjectPos(Kutija, ox, oy, oz);
  165. DestroyObject(Boja);
  166. //DestroyObject(P[5]);
  167. switch(Rand)
  168. {
  169. case 1:
  170. {
  171. Boja = CreateObject(19281, ox, oy, oz, 0.00, 0.00, 0.00);//Bela
  172. }
  173. case 2:
  174. {
  175. Boja = CreateObject(19282, ox, oy, oz, 0.00, 0.00, 0.00);//Crvena
  176. }
  177. case 3:
  178. {
  179. Boja = CreateObject(19283, ox, oy, oz, 0.00, 0.00, 0.00);//Zelena
  180. }
  181. case 4:
  182. {
  183. Boja = CreateObject(19284, ox, oy, oz, 0.00, 0.00, 0.00);//Plava
  184. }
  185. }
  186. new rx = random(10), ry = random(10), rz = random(7);
  187. MoveObject(Boja, ox+rx, oy+ry, oz+25+rz, 25.00);
  188. KrajPucanja1 = SetTimer("Pucanje3",1000,0);
  189. SetTimer("KrajVatrometa1",TrajanjeVatrometa1,0);
  190. return 1;
  191. }
  192.  
  193. public Pucanje3()
  194. {
  195. new Float:ox, Float:oy, Float:oz;
  196. GetObjectPos(Boja, ox, oy, oz);
  197. CreateObject(18685, ox, oy, oz, 0.00, 0.00, 0.00);//Explozija
  198. for(new i = 0; i < MAX_PLAYERS; i++)
  199. {
  200. PlayerPlaySound(i, 1159, ox, oy, oz-25);
  201. }
  202. SetTimer("StvaranjeBoja",300,0);
  203. return 1;
  204. }
  205.  
  206. public KrajVatrometa1()
  207. {
  208. KillTimer(KrajPucanja1);
  209. DestroyObject(Boja);
  210. DestroyObject(Kutija);
  211. return 1;
  212. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement