Advertisement
946ben

[9B] RocketScript

May 12th, 2012
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 14.62 KB | None | 0 0
  1. /*
  2. *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
  3. *
  4. * SA-MP RocketScript
  5. *
  6. *  (c) Copyright 2012, 946ben
  7. *
  8. *       9999999999   BBBBBBBBBBB
  9. *       9999999999   BBBBBBBBBBB
  10. *       999    999   BBB        BBB
  11. *       999    999   BBB        BBB
  12. *       999    999   BBB        BBB
  13. *       9999999999   BBB   BBBBB
  14. *       9999999999   BBB   BBBBB
  15. *              999   BBB        BBB
  16. *              999   BBB        BBB
  17. *              999   BBB        BBB
  18. *       9999999999   BBBBBBBBBBB
  19. *       9999999999   BBBBBBBBBBB
  20. *
  21. *
  22. *       RRRRRRRRRR   SSSSSSSSSSS
  23. *       RRRRRRRRRR   SSSSSSSSSSS
  24. *       RRR    RRR   SSS
  25. *       RRR    RRR   SSS
  26. *       RRRRRRRRRR   SSSSSSSSSSS
  27. *       RRRRRRRRRR   SSSSSSSSSSS
  28. *       RRR  RRR             SSS
  29. *       RRR  RRR             SSS
  30. *       RRR    RRR   SSSSSSSSSSS
  31. *       RRR    RRR   SSSSSSSSSSS
  32. *
  33. *
  34. *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
  35. *
  36. * Voraussetzungen:
  37. *   -ZCMD Include
  38. *   -MapAndreas Plugin
  39. *   -MapAndreas Include
  40. *
  41. *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
  42. *
  43. * All rights reserved.
  44. *
  45. * Redistribution and use in source , with or without modification,
  46. * are permitted provided that the following conditions are met:
  47. *
  48. *     * Redistributions of source code must retain the above copyright notice, this
  49. *       list of conditions and the following disclaimer.
  50. *     * Redistributions in binary form must reproduce the above copyright notice, this
  51. *       list of conditions and the following disclaimer in the documentation and/or other
  52. *       materials provided with the distribution.
  53. *
  54. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  55. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  56. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  57. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  58. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  59. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  60. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  61. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  62. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  63. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  64. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  65. *
  66. *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
  67. *
  68. */
  69.  
  70.  
  71. // VERSION v1.1
  72.  
  73. #include <a_samp>
  74. #include <mapandreas>
  75. #include <zcmd>
  76.  
  77. #define RED 0xB90000FF
  78.  
  79. new timer;
  80. new count;
  81. new Float:size;
  82. new obj;
  83. new move;
  84. new pickup;
  85. new bool:isstarting;
  86. new bool:playerstarting[MAX_PLAYERS];
  87. new bool:placed;
  88. new string[5];
  89. new Text:Textdraw1;
  90. new Text:Textdraw2;
  91. new Text:Textdraw3;
  92. new Text:Textdraw4;
  93. new Text:Textdraw5;
  94. new Text:Textdraw6;
  95. new Text:Textdraw7;
  96. new Text:Textdraw8;
  97. new Text:Textdraw9;
  98.  
  99. public OnFilterScriptInit() {
  100.  
  101.     MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
  102.    
  103.     pickup = CreatePickup(1210, 1, 212.4329,1822.8763,6.4141, -1);
  104.  
  105.     Textdraw1 = TextDrawCreate(152.000000, 320.000000, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~"); // Hintergrund
  106.     TextDrawBackgroundColor(Textdraw1, 255);
  107.     TextDrawFont(Textdraw1, 1);
  108.     TextDrawLetterSize(Textdraw1, 0.500000, 1.000000);
  109.     TextDrawColor(Textdraw1, -1);
  110.     TextDrawSetOutline(Textdraw1, 0);
  111.     TextDrawSetProportional(Textdraw1, 1);
  112.     TextDrawSetShadow(Textdraw1, 1);
  113.     TextDrawUseBox(Textdraw1, 1);
  114.     TextDrawBoxColor(Textdraw1, 1347440790);
  115.     TextDrawTextSize(Textdraw1, 486.000000, 0.000000);
  116.  
  117.     Textdraw2 = TextDrawCreate(170.000000, 334.000000, "~n~"); // Balken schwarz
  118.     TextDrawBackgroundColor(Textdraw2, 255);
  119.     TextDrawFont(Textdraw2, 1);
  120.     TextDrawLetterSize(Textdraw2, 0.500000, 1.000000);
  121.     TextDrawColor(Textdraw2, -1);
  122.     TextDrawSetOutline(Textdraw2, 0);
  123.     TextDrawSetProportional(Textdraw2, 1);
  124.     TextDrawSetShadow(Textdraw2, 1);
  125.     TextDrawUseBox(Textdraw2, 1);
  126.     TextDrawBoxColor(Textdraw2, 255);
  127.     TextDrawTextSize(Textdraw2, 470.000000, 20.000000);
  128.  
  129.     Textdraw3 = TextDrawCreate(170.000000, 334.000000, "~n~"); // Balken rot
  130.     TextDrawBackgroundColor(Textdraw3, 255);
  131.     TextDrawFont(Textdraw3, 1);
  132.     TextDrawLetterSize(Textdraw3, 0.500000, 1.000000);
  133.     TextDrawColor(Textdraw3, -1);
  134.     TextDrawSetOutline(Textdraw3, 0);
  135.     TextDrawSetProportional(Textdraw3, 1);
  136.     TextDrawSetShadow(Textdraw3, 1);
  137.     TextDrawUseBox(Textdraw3, 1);
  138.     TextDrawBoxColor(Textdraw3, -16776961);
  139.     TextDrawTextSize(Textdraw3, 170.000000, 20.000000);
  140.  
  141.     Textdraw4 = TextDrawCreate(304.000000, 333.000000, "100"); // Balken Zahl
  142.     TextDrawBackgroundColor(Textdraw4, 255);
  143.     TextDrawFont(Textdraw4, 1);
  144.     TextDrawLetterSize(Textdraw4, 0.500000, 1.000000);
  145.     TextDrawColor(Textdraw4, -1);
  146.     TextDrawSetOutline(Textdraw4, 0);
  147.     TextDrawSetProportional(Textdraw4, 1);
  148.     TextDrawSetShadow(Textdraw4, 1);
  149.  
  150.     Textdraw5 = TextDrawCreate(168.000000, 361.000000, "Bereite Raketeneinheit vor...");  // Statusanzeige
  151.     TextDrawBackgroundColor(Textdraw5, 255);
  152.     TextDrawFont(Textdraw5, 1);
  153.     TextDrawLetterSize(Textdraw5, 0.519999, 1.900000);
  154.     TextDrawColor(Textdraw5, -1);
  155.     TextDrawSetOutline(Textdraw5, 0);
  156.     TextDrawSetProportional(Textdraw5, 1);
  157.     TextDrawSetShadow(Textdraw5, 1);
  158.  
  159.     Textdraw6 = TextDrawCreate(30.000000, 130.000000, "~g~Bitte geben Sie die Position an, an der die Rakete explodieren soll.~n~~g~Verwenden Sie dazu folgende Technik:"); // Info-Text
  160.     TextDrawBackgroundColor(Textdraw6, 255);
  161.     TextDrawFont(Textdraw6, 1);
  162.     TextDrawLetterSize(Textdraw6, 0.460000, 1.400000);
  163.     TextDrawColor(Textdraw6, -1);
  164.     TextDrawSetOutline(Textdraw6, 0);
  165.     TextDrawSetProportional(Textdraw6, 1);
  166.     TextDrawSetShadow(Textdraw6, 1);
  167.  
  168.     Textdraw7 = TextDrawCreate(42.000000, 161.000000, "~r~-Gehen Sie via ESC auf die Karte~n~~r~-Klicken Sie dort an der Stelle mit der rechten Maustaste"); // Info-Text
  169.     TextDrawBackgroundColor(Textdraw7, 255);
  170.     TextDrawFont(Textdraw7, 1);
  171.     TextDrawLetterSize(Textdraw7, 0.460000, 1.400000);
  172.     TextDrawColor(Textdraw7, -1);
  173.     TextDrawSetOutline(Textdraw7, 0);
  174.     TextDrawSetProportional(Textdraw7, 1);
  175.     TextDrawSetShadow(Textdraw7, 1);
  176.  
  177.     Textdraw8 = TextDrawCreate(42.000000, 186.000000, "~r~-Kommen Sie dann ins Spiel zurueck"); // Info-Text
  178.     TextDrawBackgroundColor(Textdraw8, 255);
  179.     TextDrawFont(Textdraw8, 1);
  180.     TextDrawLetterSize(Textdraw8, 0.460000, 1.400000);
  181.     TextDrawColor(Textdraw8, -1);
  182.     TextDrawSetOutline(Textdraw8, 0);
  183.     TextDrawSetProportional(Textdraw8, 1);
  184.     TextDrawSetShadow(Textdraw8, 1);
  185.  
  186.     Textdraw9 = TextDrawCreate(30.000000, 130.000000, "Koordinaten erfolgreich angegeben. Bitte warten!"); // Koordeingabe fertig
  187.     TextDrawBackgroundColor(Textdraw9, 255);
  188.     TextDrawFont(Textdraw9, 1);
  189.     TextDrawLetterSize(Textdraw9, 0.460000, 1.400000);
  190.     TextDrawColor(Textdraw9, -11534081);
  191.     TextDrawSetOutline(Textdraw9, 0);
  192.     TextDrawSetProportional(Textdraw9, 1);
  193.     TextDrawSetShadow(Textdraw9, 1);
  194.  
  195.     return 1;
  196. }
  197.  
  198. public OnFilterScriptExit() {
  199.     DestroyPickup(pickup);
  200.     return 1;
  201. }
  202.  
  203. public OnPlayerConnect(playerid) {
  204.     playerstarting[playerid] = false;
  205.     return 1;
  206. }
  207.  
  208. public OnPlayerPickUpPickup(playerid, pickupid)
  209. {
  210.     if(pickupid == pickup) GameTextForPlayer(playerid, "/startrocket", 2000, 0);
  211.     return 1;
  212. }
  213.  
  214. forward rtimer(playerid, Float:zx, Float:zy, Float:zz);
  215. public rtimer(playerid, Float:zx, Float:zy, Float:zz) {
  216.     if(count == 40) {
  217.         PlayerPlaySound(playerid, 5201, 0.0, 0.0, 0);
  218.         TextDrawSetString(Textdraw5, "Warte auf Koordinateneingabe...");
  219.         TextDrawShowForPlayer(playerid, Textdraw6);
  220.         TextDrawShowForPlayer(playerid, Textdraw7);
  221.         TextDrawShowForPlayer(playerid, Textdraw8);
  222.         placed = false;
  223.         KillTimer(timer);
  224.         return 1;
  225.     }
  226.     if(count == 39) {
  227.         TextDrawSetString(Textdraw5, "Bereite Startsequenz vor...");
  228.     }
  229.     if(count == 16) {
  230.         TextDrawSetString(Textdraw5, "Bereite Countdown vor...");
  231.     }
  232.     if(count == 11) {
  233.         TextDrawSetString(Textdraw5, "Rakete wird gestartet...");
  234.     }
  235.     if(count == 0) {
  236.         TextDrawHideForPlayer(playerid, Textdraw1);
  237.         TextDrawHideForPlayer(playerid, Textdraw2);
  238.         TextDrawHideForPlayer(playerid, Textdraw3);
  239.         TextDrawHideForPlayer(playerid, Textdraw4);
  240.         TextDrawHideForPlayer(playerid, Textdraw5);
  241.         TextDrawSetString(Textdraw9, "Rakete erfolgreich gestartet!");
  242.         TextDrawShowForPlayer(playerid, Textdraw9);
  243.         KillTimer(timer);
  244.         SetTimerEx("rtimer3", 5000, 0, "ifff", playerid, zx, zy, zz);
  245.         new Float:x, Float:y, Float:z;
  246.         TogglePlayerControllable(playerid, 1);
  247.         GetPlayerPos(playerid, x, y, z);
  248.         obj = CreateObject(354, x, y, z+10, 0.0, 0.0, 0.0);
  249.         move = MoveObject(obj, x, y, 500, 80);
  250.         new rand = random(2);
  251.         if(rand == 0) {
  252.             SendClientMessageToAll(RED, "[Raketenalarm] Die Frühwarnsysteme haben eine Rakete im Luftraum von San Andreas gemeldet");
  253.             SendClientMessageToAll(RED, "[Raketenalarm] Bitte bewahren Sie Ruhe!");
  254.         }
  255.         SetTimerEx("rtimer4", 1000+move, 0, "fff", zx, zy, zz);
  256.         return 1;
  257.     }
  258.     count = count-1;
  259.     if(count == 38) PlayerPlaySound(playerid, 5201, 0.0, 0.0, 0);
  260.     if(count == 15) PlayerPlaySound(playerid, 5201, 0.0, 0.0, 0);
  261.     if(count < 11) PlayerPlaySound(playerid, 5201, 0.0, 0.0, 0);
  262.     valstr(string, count);
  263.     TextDrawSetString(Textdraw4, string);
  264.     size = size+float(6);
  265.     TextDrawTextSize(Textdraw3, size, 20.000000);
  266.     TextDrawShowForPlayer(playerid, Textdraw3);
  267.     return 1;
  268. }
  269.  
  270. forward rtimer2(playerid, Float:zx, Float:zy, Float:zz);
  271. public rtimer2(playerid, Float:zx, Float:zy, Float:zz) {
  272.     count = count-1;
  273.     valstr(string, count);
  274.     TextDrawSetString(Textdraw4, string);
  275.     size = size+float(6);
  276.     TextDrawTextSize(Textdraw3, size, 20.000000);
  277.     TextDrawShowForPlayer(playerid, Textdraw3);
  278.     timer = SetTimerEx("rtimer", 1000, 1, "ifff", playerid, zx, zy, zz);
  279.     TextDrawHideForPlayer(playerid, Textdraw9);
  280.     return 1;
  281. }
  282.  
  283. forward rtimer3(playerid, Float:zx, Float:zy, Float:zz);
  284. public rtimer3(playerid, Float:zx, Float:zy, Float:zz) {
  285.     TextDrawHideForPlayer(playerid, Textdraw9);
  286.     playerstarting[playerid] = false;
  287.     isstarting = false;
  288.     return 1;
  289. }
  290.  
  291. forward rtimer4(Float:zx, Float:zy, Float:zz);
  292. public rtimer4(Float:zx, Float:zy, Float:zz) {
  293.     DestroyObject(obj);
  294.     obj = CreateObject(354, zx, zy, 500, 0.0, 0.0, 0.0);
  295.     move = MoveObject(obj, zx, zy, zz, 100);
  296.     SetTimerEx("rtimer5", move, 0, "fff", zx, zy, zz);
  297.     return 1;
  298. }
  299.  
  300. forward rtimer5(Float:zx, Float:zy, Float:zz);
  301. public rtimer5(Float:zx, Float:zy, Float:zz) {
  302.     DestroyObject(obj);
  303.     CreateExplosion(zx, zy, zz, 0, 10.0);
  304.     CreateExplosion(zx, zy, zz+3, 0, 10.0);
  305.     CreateExplosion(zx-3, zy, zz, 0, 10.0);
  306.     CreateExplosion(zx+3, zy, zz, 0, 10.0);
  307.     CreateExplosion(zx, zy-3, zz, 0, 10.0);
  308.     CreateExplosion(zx, zy+3, zz, 0, 10.0);
  309.     CreateExplosion(zx-3, zy+3, zz, 0, 10.0);
  310.     CreateExplosion(zx+3, zy-3, zz, 0, 10.0);
  311.     CreateExplosion(zx-3, zy-3, zz, 0, 10.0);
  312.     CreateExplosion(zx+3, zy+3, zz, 0, 10.0);
  313.     CreateExplosion(zx-6, zy, zz, 0, 10.0);
  314.     CreateExplosion(zx+6, zy, zz, 0, 10.0);
  315.     CreateExplosion(zx, zy-6, zz, 0, 10.0);
  316.     CreateExplosion(zx, zy+6, zz, 0, 10.0);
  317.     CreateExplosion(zx-6, zy+6, zz, 0, 10.0);
  318.     CreateExplosion(zx+6, zy-6, zz, 0, 10.0);
  319.     CreateExplosion(zx-6, zy-6, zz, 0, 10.0);
  320.     CreateExplosion(zx+6, zy+6, zz, 0, 10.0);
  321.     CreateExplosion(zx-9, zy, zz, 0, 10.0);
  322.     CreateExplosion(zx+9, zy, zz, 0, 10.0);
  323.     CreateExplosion(zx, zy-9, zz, 0, 10.0);
  324.     CreateExplosion(zx, zy+9, zz, 0, 10.0);
  325.     CreateExplosion(zx-9, zy+9, zz, 0, 10.0);
  326.     CreateExplosion(zx+9, zy-9, zz, 0, 10.0);
  327.     CreateExplosion(zx-9, zy-9, zz, 0, 10.0);
  328.     CreateExplosion(zx+9, zy+9, zz, 0, 10.0);
  329.     SetTimerEx("rtimer6", 1000, 0, "fff", zx, zy, zz);
  330.     SetTimerEx("rtimer6", 2000, 0, "fff", zx, zy, zz);
  331.     SetTimerEx("rtimer6", 3000, 0, "fff", zx, zy, zz);
  332.     SetTimerEx("rtimer6", 4000, 0, "fff", zx, zy, zz);
  333.     return 1;
  334. }
  335.  
  336. forward rtimer6(Float:zx, Float:zy, Float:zz);
  337. public rtimer6(Float:zx, Float:zy, Float:zz) {
  338.     CreateExplosion(zx, zy, zz, 0, 10.0);
  339.     CreateExplosion(zx, zy, zz+3, 0, 10.0);
  340.     CreateExplosion(zx-3, zy, zz, 0, 10.0);
  341.     CreateExplosion(zx+3, zy, zz, 0, 10.0);
  342.     CreateExplosion(zx, zy-3, zz, 0, 10.0);
  343.     CreateExplosion(zx, zy+3, zz, 0, 10.0);
  344.     CreateExplosion(zx-3, zy+3, zz, 0, 10.0);
  345.     CreateExplosion(zx+3, zy-3, zz, 0, 10.0);
  346.     CreateExplosion(zx-3, zy-3, zz, 0, 10.0);
  347.     CreateExplosion(zx+3, zy+3, zz, 0, 10.0);
  348.     CreateExplosion(zx-6, zy, zz, 0, 10.0);
  349.     CreateExplosion(zx+6, zy, zz, 0, 10.0);
  350.     CreateExplosion(zx, zy-6, zz, 0, 10.0);
  351.     CreateExplosion(zx, zy+6, zz, 0, 10.0);
  352.     CreateExplosion(zx-6, zy+6, zz, 0, 10.0);
  353.     CreateExplosion(zx+6, zy-6, zz, 0, 10.0);
  354.     CreateExplosion(zx-6, zy-6, zz, 0, 10.0);
  355.     CreateExplosion(zx+6, zy+6, zz, 0, 10.0);
  356.     CreateExplosion(zx-9, zy, zz, 0, 10.0);
  357.     CreateExplosion(zx+9, zy, zz, 0, 10.0);
  358.     CreateExplosion(zx, zy-9, zz, 0, 10.0);
  359.     CreateExplosion(zx, zy+9, zz, 0, 10.0);
  360.     CreateExplosion(zx-9, zy+9, zz, 0, 10.0);
  361.     CreateExplosion(zx+9, zy-9, zz, 0, 10.0);
  362.     CreateExplosion(zx-9, zy-9, zz, 0, 10.0);
  363.     CreateExplosion(zx+9, zy+9, zz, 0, 10.0);
  364.     return 1;
  365. }
  366.  
  367. public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ) {
  368.     if(playerstarting[playerid] == false) return 0;
  369.     if(placed == true) return 0;
  370.     placed = true;
  371.     TextDrawSetString(Textdraw9, "Koordinaten erfolgreich angegeben. Bitte warten!");
  372.     TextDrawHideForPlayer(playerid, Textdraw6);
  373.     TextDrawHideForPlayer(playerid, Textdraw7);
  374.     TextDrawHideForPlayer(playerid, Textdraw8);
  375.     TextDrawShowForPlayer(playerid, Textdraw9);
  376.     MapAndreas_FindZ_For2DCoord(fX, fY, fZ);
  377.     SetTimerEx("rtimer2", 5000, 0, "ifff", playerid, fX, fY, fZ);
  378.     return 1;
  379. }
  380.  
  381. COMMAND:startrocket(playerid,params[]) {
  382.     if(!IsPlayerInRangeOfPoint(playerid, 5.0, 212.4329,1822.8763,6.4141)) return 1;
  383.     if(isstarting) return 0;
  384.     TogglePlayerControllable(playerid, 0);
  385.     isstarting = true;
  386.     playerstarting[playerid] = true;
  387.     TextDrawTextSize(Textdraw3, 170.000000, 20.000000);
  388.     TextDrawSetString(Textdraw4, "50");
  389.     TextDrawSetString(Textdraw5, "Bereite Raketeneinheit vor...");
  390.     size = float(170);
  391.     count = 50;
  392.     TextDrawShowForPlayer(playerid, Textdraw1);
  393.     TextDrawShowForPlayer(playerid, Textdraw2);
  394.     TextDrawShowForPlayer(playerid, Textdraw3);
  395.     TextDrawShowForPlayer(playerid, Textdraw4);
  396.     TextDrawShowForPlayer(playerid, Textdraw5);
  397.     timer = SetTimerEx("rtimer", 1000, 1, "ifff", playerid, float(1), float(1), float(1));
  398.     return 1;
  399. }
  400.  
  401. // Testing commands
  402.  
  403. COMMAND:goto(playerid,params[]) {
  404.     SetPlayerPos(playerid,217.8016,1823.1212,6.4141);
  405.     return 1;
  406. }
  407.  
  408. COMMAND:top(playerid,params[]) {
  409.     new Float:x, Float:y, Float:z;
  410.     GetPlayerPos(playerid, x, y, z);
  411.     MapAndreas_FindZ_For2DCoord(x, y, z);
  412.     SetPlayerPos(playerid, x, y, z);
  413.     return 1;
  414. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement