Advertisement
OtaconEvil

[FS] System of Bomb By OTACON [EN]

Sep 11th, 2014
825
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 13.23 KB | None | 0 0
  1. /*
  2.     * ## LEASE ATENTAMENTE PARA NO CONVERTIRSE EN LAMMER!!.: :D ##
  3.     *
  4.     * Estè Simple FILTERSCRIPT esta hecho especialmente para www.forum.sa-mp.com
  5.     * NO Publicar estè FILTERSCRIPT en Otros foros de SA-MP y hacerse pasar por el creador del CODE.
  6.     *
  7.     * Codigo Creado Por OTACON
  8.     *
  9.     * CREDITOS:
  10.     *     OTACON: Realizacion y Idea de creacion del code.
  11.     *     TÙ: Modificacion libremente respetando lo mencionado ;).
  12.     *
  13.     *    NOTA: Menos Creditos para los que me los critican.. JO'PUTAS! :D xD ;)
  14.     *
  15.     *                Prohibido TOTALMENTE el Robo de Créditos o la
  16.     *                  Publicación de este FILTERSCRIPT sin Mi Permiso.
  17. */
  18. /*
  19.     * ## READ CAREFULLY TO AVOID BECOMING LAMMER!.: :D ##
  20.     *
  21.     * This simple FILTERSCRIPT is made especially for www.forum.sa-mp.com
  22.     * DO NOT Post the FILTERSCRIPT in Other SAMP forums and impersonating the creator of the CODE.
  23.     *
  24.     * Code Created By OTACON
  25.     *
  26.     * CREDITS:
  27.     *     OTACON: Idea Making and code creation.
  28.     *     YOUR: Modification freely respecting the above ;).
  29.     *
  30.     *    NOTE: Less Credits for those who criticize me.. JO'PUTAS! :D xD ;)
  31.     *
  32.     *                        FULLY spaces Theft Credit or
  33.     *                 Publication of this FILTERSCRIPT without my permission.
  34. */
  35.  
  36. #include <a_samp>
  37. #include <zcmd>
  38. #include <player_progressbar>
  39. #define pressed(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  40. #define released(%0) (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
  41.  
  42. #define COLOR_BAR_1 0xD9D9D9FF //white
  43. #define COLOR_BAR_2 0xB71700FF //red
  44. #define MAX_Bomb (5)
  45. #define ID_Bomb (1654)
  46. #define TIMER_BOOM (30)
  47. #define PAY_Bomb (1500)
  48. enum BombInfo {
  49.     bool:BombActive,
  50.     CantidadBomb,
  51.     Float:PosBombX,
  52.     Float:PosBombY,
  53.     Float:PosBombZ,
  54.     Float:PosBombA,
  55.     PlacingKilling,
  56.     ExploitingKilling,
  57.     CountingBoom,
  58.     BombObject, };
  59. new Bomb[MAX_PLAYERS][BombInfo];
  60. new PlayerBar:BarBomb[MAX_PLAYERS][2];
  61. new PlayerText:TextBomb[MAX_PLAYERS][3];
  62.  
  63. public OnPlayerConnect(playerid) {
  64.     new data[128];
  65.     TextBomb[playerid][0]=CreatePlayerTextDraw(playerid,413.000000, 104.000000, "_");
  66.     PlayerTextDrawBackgroundColor(playerid,TextBomb[playerid][0], 255);
  67.     PlayerTextDrawFont(playerid,TextBomb[playerid][0], 1);
  68.     PlayerTextDrawLetterSize(playerid,TextBomb[playerid][0], 0.270000, 1.300000);
  69.     PlayerTextDrawColor(playerid,TextBomb[playerid][0], -1);
  70.     PlayerTextDrawSetOutline(playerid,TextBomb[playerid][0], 1);
  71.     PlayerTextDrawSetProportional(playerid,TextBomb[playerid][0], 1);
  72.     PlayerTextDrawSetSelectable(playerid,TextBomb[playerid][0], 0);
  73.  
  74.     TextBomb[playerid][1]=CreatePlayerTextDraw(playerid,322.000000, 50.000000, "_");
  75.     PlayerTextDrawAlignment(playerid,TextBomb[playerid][1], 2);
  76.     PlayerTextDrawBackgroundColor(playerid,TextBomb[playerid][1], 255);
  77.     PlayerTextDrawFont(playerid,TextBomb[playerid][1], 2);
  78.     PlayerTextDrawLetterSize(playerid,TextBomb[playerid][1], 0.670000, 3.300000);
  79.     PlayerTextDrawColor(playerid,TextBomb[playerid][1], -1);
  80.     PlayerTextDrawSetOutline(playerid,TextBomb[playerid][1], 1);
  81.     PlayerTextDrawSetProportional(playerid,TextBomb[playerid][1], 1);
  82.     PlayerTextDrawUseBox(playerid,TextBomb[playerid][1], 1);
  83.     PlayerTextDrawBoxColor(playerid,TextBomb[playerid][1], 0x0000155);
  84.     PlayerTextDrawTextSize(playerid,TextBomb[playerid][1], 80.000000, 98.000000);
  85.     PlayerTextDrawSetSelectable(playerid,TextBomb[playerid][1], 0);
  86.  
  87.     TextBomb[playerid][2]=CreatePlayerTextDraw(playerid,512.000000, 136.000000, "_");
  88.     PlayerTextDrawAlignment(playerid,TextBomb[playerid][2], 2);
  89.     PlayerTextDrawBackgroundColor(playerid,TextBomb[playerid][2], 255);
  90.     PlayerTextDrawFont(playerid,TextBomb[playerid][2], 2);
  91.     PlayerTextDrawLetterSize(playerid,TextBomb[playerid][2], 0.220000, 1.500000);
  92.     PlayerTextDrawColor(playerid,TextBomb[playerid][2], -1);
  93.     PlayerTextDrawSetOutline(playerid,TextBomb[playerid][2], 1);
  94.     PlayerTextDrawSetProportional(playerid,TextBomb[playerid][2], 1);
  95.     PlayerTextDrawSetSelectable(playerid,TextBomb[playerid][2], 0);
  96.     format(data,sizeof(data), "~w~amount of bomb: ~g~%02d/%02d", Bomb[playerid][CantidadBomb], MAX_Bomb);
  97.     PlayerTextDrawSetString(playerid,TextBomb[playerid][2], data);
  98.  
  99.     BarBomb[playerid][0]=CreatePlayerProgressBar(playerid, 503.000000, 110.000000, 55.500000, 3.200000, COLOR_BAR_1, 100.0);
  100.     SetPlayerProgressBarMaxValue(playerid, BarBomb[playerid][0], 100.0);
  101.     SetPlayerProgressBarValue(playerid, BarBomb[playerid][0], 0);
  102.     BarBomb[playerid][1]=CreatePlayerProgressBar(playerid, 503.000000, 122.000000, 101.500000, 3.199999, COLOR_BAR_2, 100.0);
  103.     SetPlayerProgressBarMaxValue(playerid, BarBomb[playerid][1], Float:float(TIMER_BOOM));
  104.     SetPlayerProgressBarValue(playerid, BarBomb[playerid][1], Float:float(TIMER_BOOM));
  105.     Bomb[playerid][BombActive]=false;
  106.     Bomb[playerid][CountingBoom]=0;
  107.     return true;
  108. }
  109. public OnPlayerDisconnect(playerid, reason) {
  110.     HidePlayerProgressBar(playerid, BarBomb[playerid][0]);
  111.     HidePlayerProgressBar(playerid, BarBomb[playerid][1]);
  112.     PlayerTextDrawHide(playerid, TextBomb[playerid][0]);
  113.     PlayerTextDrawHide(playerid, TextBomb[playerid][1]);
  114.     PlayerTextDrawHide(playerid, TextBomb[playerid][2]);
  115.     KillTimer(Bomb[playerid][PlacingKilling]);
  116.     KillTimer(Bomb[playerid][ExploitingKilling]);
  117.     Bomb[playerid][BombActive]=false;
  118.     Bomb[playerid][CountingBoom]=0;
  119.     return true;
  120. }
  121. public OnPlayerDeath(playerid, killerid, reason) {
  122.     HidePlayerProgressBar(playerid, BarBomb[playerid][0]);
  123.     HidePlayerProgressBar(playerid, BarBomb[playerid][1]);
  124.     PlayerTextDrawHide(playerid, TextBomb[playerid][0]);
  125.     PlayerTextDrawHide(playerid, TextBomb[playerid][1]);
  126.     PlayerTextDrawHide(playerid, TextBomb[playerid][2]);
  127.     KillTimer(Bomb[playerid][PlacingKilling]);
  128.     KillTimer(Bomb[playerid][ExploitingKilling]);
  129.     Bomb[playerid][BombActive]=false;
  130.     Bomb[playerid][CountingBoom]=0;
  131.     Bomb[playerid][CantidadBomb]=0;
  132.     DestroyObject(Bomb[playerid][BombObject]);
  133.     return true;
  134. }
  135. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
  136.     if(pressed(KEY_HANDBRAKE)) {
  137.         switch(Bomb[playerid][BombActive]) {
  138.             case true: {
  139.                 if(Bomb[playerid][CantidadBomb]<=0) return SendClientMessage(playerid, -1,"  [ ! ] You have to place bombs!.");
  140.                 ShowPlayerProgressBar(playerid, BarBomb[playerid][0]);
  141.                 PlayerTextDrawShow(playerid, TextBomb[playerid][0]);
  142.                 PlayerTextDrawSetString(playerid,TextBomb[playerid][0], "~w~Placing Bomb:");
  143.                 ApplyAnimation(playerid,"BOMBER","BOM_Plant_Crouch_In",4.1,0,1,1,1,1);
  144.                 Bomb[playerid][PlacingKilling]=SetTimerEx("PlacingBomb", 150, true, "d", playerid);
  145.                 GameTextForPlayer(playerid, "~n~~n~~n~~g~Placing Bomb...", 4000, 3);
  146.                 GetPlayerPos(playerid, Bomb[playerid][PosBombX], Bomb[playerid][PosBombY], Bomb[playerid][PosBombZ]);
  147.                 GetPlayerFacingAngle(playerid,Bomb[playerid][PosBombA]);
  148.                 DestroyObject(Bomb[playerid][BombObject]);
  149.                 Bomb[playerid][PosBombX] = Bomb[playerid][PosBombX] + (0.6 * floatsin(-Bomb[playerid][PosBombA], degrees));
  150.                 Bomb[playerid][PosBombY] = Bomb[playerid][PosBombY] + (0.6 * floatcos(-Bomb[playerid][PosBombA], degrees));
  151.                 Bomb[playerid][BombObject]=CreateObject(ID_Bomb, Bomb[playerid][PosBombX], Bomb[playerid][PosBombY], Bomb[playerid][PosBombZ]-0.8, 0.0, 0.0, Bomb[playerid][PosBombA]);
  152.             }
  153.         }
  154.     }
  155.     if(released(KEY_HANDBRAKE)) {
  156.         switch(Bomb[playerid][BombActive]) {
  157.             case true: {
  158.                 HidePlayerProgressBar(playerid, BarBomb[playerid][0]);
  159.                 PlayerTextDrawHide(playerid, TextBomb[playerid][0]);
  160.                 ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,0,0,0,0,0);
  161.                 KillTimer(Bomb[playerid][ExploitingKilling]);
  162.                 KillTimer(Bomb[playerid][PlacingKilling]);
  163.                 Bomb[playerid][CountingBoom]=0;
  164.                 DestroyObject(Bomb[playerid][BombObject]);
  165.             }
  166.         }
  167.     } return true;
  168. }
  169. forward PlacingBomb(playerid);
  170. public PlacingBomb(playerid) {
  171.     new data[100];
  172.     Bomb[playerid][CountingBoom]++;
  173.     SetPlayerProgressBarValue(playerid, BarBomb[playerid][0], Bomb[playerid][CountingBoom]);
  174.     UpdatePlayerProgressBar(playerid, BarBomb[playerid][0]);
  175.     if(Bomb[playerid][CountingBoom]>=100) {
  176.         GameTextForPlayer(playerid, "~n~~n~~n~~g~Bomb Placed!", 4000, 3);
  177.         Bomb[playerid][CountingBoom]=0;
  178.         Bomb[playerid][CountingBoom]=TIMER_BOOM;
  179.         Bomb[playerid][CantidadBomb]--;
  180.         format(data,sizeof(data), "~w~amount of bomb: ~g~%02d/%02d", Bomb[playerid][CantidadBomb], MAX_Bomb);
  181.         PlayerTextDrawSetString(playerid,TextBomb[playerid][2], data);
  182.         HidePlayerProgressBar(playerid, BarBomb[playerid][0]);
  183.         ShowPlayerProgressBar(playerid, BarBomb[playerid][1]);
  184.         PlayerTextDrawShow(playerid, TextBomb[playerid][1]);
  185.         PlayerTextDrawSetString(playerid,TextBomb[playerid][0], "~w~~n~Explosion time:");
  186.         ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,0,0,0,0,0);
  187.         KillTimer(Bomb[playerid][PlacingKilling]);
  188.         Bomb[playerid][ExploitingKilling]=SetTimerEx("ExplodingBomb", 1*1000, true, "d", playerid);
  189.         Bomb[playerid][BombActive]=false;
  190.     } return true;
  191. }
  192. forward ExplodingBomb(playerid);
  193. public ExplodingBomb(playerid) {
  194.     new data[20];
  195.     Bomb[playerid][CountingBoom]--;
  196.     SetPlayerProgressBarValue(playerid, BarBomb[playerid][1], Bomb[playerid][CountingBoom]);
  197.     UpdatePlayerProgressBar(playerid, BarBomb[playerid][1]);
  198.     format(data,sizeof(data), "~w~00:%02d", Bomb[playerid][CountingBoom]);
  199.     PlayerTextDrawSetString(playerid,TextBomb[playerid][1], data);
  200.     PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  201.     if(Bomb[playerid][CountingBoom]<=0) {
  202.         KillTimer(Bomb[playerid][ExploitingKilling]);
  203.         KillTimer(Bomb[playerid][PlacingKilling]);
  204.         Bomb[playerid][CountingBoom]=0;
  205.         HidePlayerProgressBar(playerid, BarBomb[playerid][1]);
  206.         PlayerTextDrawHide(playerid, TextBomb[playerid][0]);
  207.         PlayerTextDrawHide(playerid, TextBomb[playerid][1]);
  208.         DestroyObject(Bomb[playerid][BombObject]);
  209.         GameTextForPlayer(playerid, "~n~~n~~n~~w~BOOM!!.", 4000, 3);
  210.         CreateExplosion(Bomb[playerid][PosBombX], Bomb[playerid][PosBombY], Bomb[playerid][PosBombZ], 1, 30.0);
  211.         CreateExplosion(Bomb[playerid][PosBombX], Bomb[playerid][PosBombY], Bomb[playerid][PosBombZ], 2, 30.0);
  212.         CreateExplosion(Bomb[playerid][PosBombX], Bomb[playerid][PosBombY], Bomb[playerid][PosBombZ], 3, 30.0);
  213.         CreateExplosion(Bomb[playerid][PosBombX], Bomb[playerid][PosBombY], Bomb[playerid][PosBombZ], 4, 30.0);
  214.         CreateExplosion(Bomb[playerid][PosBombX], Bomb[playerid][PosBombY], Bomb[playerid][PosBombZ], 5, 30.0);
  215.         CreateExplosion(Bomb[playerid][PosBombX], Bomb[playerid][PosBombY], Bomb[playerid][PosBombZ], 6, 30.0);
  216.         CreateExplosion(Bomb[playerid][PosBombX], Bomb[playerid][PosBombY], Bomb[playerid][PosBombZ], 7, 30.0);
  217.         CreateExplosion(Bomb[playerid][PosBombX], Bomb[playerid][PosBombY], Bomb[playerid][PosBombZ], 8, 30.0);
  218.         CreateExplosion(Bomb[playerid][PosBombX], Bomb[playerid][PosBombY], Bomb[playerid][PosBombZ], 9, 30.0);
  219.         CreateExplosion(Bomb[playerid][PosBombX], Bomb[playerid][PosBombY], Bomb[playerid][PosBombZ], 10, 30.0);
  220.         CreateExplosion(Bomb[playerid][PosBombX], Bomb[playerid][PosBombY], Bomb[playerid][PosBombZ], 11, 30.0);
  221.         CreateExplosion(Bomb[playerid][PosBombX], Bomb[playerid][PosBombY], Bomb[playerid][PosBombZ], 12, 30.0);
  222.         CreateExplosion(Bomb[playerid][PosBombX], Bomb[playerid][PosBombY], Bomb[playerid][PosBombZ], 13, 30.0);
  223.         Bomb[playerid][BombActive]=true;
  224.     } return true;
  225. }
  226. COMMAND:bomb(playerid, params[]) {
  227.     switch(Bomb[playerid][BombActive]) {
  228.         case false: {
  229.             Bomb[playerid][BombActive]=true;
  230.             PlayerTextDrawShow(playerid, TextBomb[playerid][2]);
  231.             SendClientMessage(playerid, -1,"  [ ! ] You have activated the bomb system!.");
  232.         }
  233.         case true: {
  234.             HidePlayerProgressBar(playerid, BarBomb[playerid][0]);
  235.             HidePlayerProgressBar(playerid, BarBomb[playerid][1]);
  236.             PlayerTextDrawHide(playerid, TextBomb[playerid][0]);
  237.             PlayerTextDrawHide(playerid, TextBomb[playerid][1]);
  238.             PlayerTextDrawHide(playerid, TextBomb[playerid][2]);
  239.             KillTimer(Bomb[playerid][PlacingKilling]);
  240.             KillTimer(Bomb[playerid][ExploitingKilling]);
  241.             Bomb[playerid][BombActive]=false;
  242.             Bomb[playerid][CountingBoom]=0;
  243.             DestroyObject(Bomb[playerid][BombObject]);
  244.             PlayerTextDrawHide(playerid, TextBomb[playerid][2]);
  245.             SendClientMessage(playerid, -1,"  [ ! ] You have disabled the bomb system!.");
  246.         }
  247.     } return true;
  248. }
  249. COMMAND:ammo(playerid, params[]) {
  250.     if(Bomb[playerid][CantidadBomb]!=0) return SendClientMessage(playerid, -1,"  [ ! ] You still have to place bombs!.");
  251.     if(GetPlayerMoney(playerid)<=0 || GetPlayerMoney(playerid)<PAY_Bomb) return SendClientMessage(playerid, -1,"  [ ! ] You do not have enough money to buy bombs!.");
  252.     new data[100];
  253.     Bomb[playerid][CantidadBomb]=MAX_Bomb;
  254.     format(data,sizeof(data), "  [ ! ] Make purchased a pack of %d bomb, por $%d - ($:%d x Bomb:%d)!.",MAX_Bomb,PAY_Bomb*MAX_Bomb,PAY_Bomb,MAX_Bomb);
  255.     SendClientMessage(playerid, -1,data);
  256.     GivePlayerMoney(playerid,(0-PAY_Bomb*MAX_Bomb));
  257.     format(data,sizeof(data), "~w~amount of bomb: ~g~%02d/%02d", Bomb[playerid][CantidadBomb], MAX_Bomb);
  258.     PlayerTextDrawSetString(playerid,TextBomb[playerid][2], data);
  259.     return true;
  260. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement