Advertisement
Guest User

[FS]BombaRelogio

a guest
Aug 27th, 2012
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.31 KB | None | 0 0
  1. /*
  2.                                          ************************************
  3.                                          *       -Filterscript-             *
  4.                                          *             Bomba Relógio v1     *
  5.                                          *       ______________________     *
  6.                                          *       Feito por: Bruno Mikio     *
  7.                                          ************************************
  8.                 /====================================\
  9.                 | VISITE: WWW.SAMPPAWNO.BLOGSPOT.COM |
  10.                 \====================================/
  11.                                 |   |
  12.                                 |   |
  13.                                 |   |
  14.                                 |   |
  15.                                 |   |
  16.                                 |   |
  17.                                 |   |
  18.                                 |___|
  19.                                
  20. */
  21. //~  ** CONFIGURAÇÂO **  ~//
  22. #define BOMBATEMPO 30     // O Tempo que levará para a bomba explodir (em segundos).
  23. #define ARMARTEMPO 6     // O Tempo que levará para armar a bomba (em segundos).
  24.  
  25. //~  ** INCLUDES **  ~//
  26. #include <a_samp>
  27.  
  28.  
  29. //~  ** CORES **  ~//
  30. #define Amarelo 0xFFFF00AA
  31.  
  32.  
  33. //~  ** OUTROS **  ~//
  34. new BombaRelogio[MAX_PLAYERS];
  35. new MS[MAX_PLAYERS];
  36. new Segundos[MAX_PLAYERS];
  37. new Minutos[MAX_PLAYERS];
  38. new Float:BombX, Float:BombY, Float:BombZ;
  39. new bombplanttime;
  40. new bombtime;
  41. new PlantouBomba[MAX_PLAYERS];
  42.  
  43. new Text:BombCount;
  44.  
  45. forward BombTime(playerid);
  46. forward BombPlantTime(playerid);
  47.  
  48. //-----------------------------------------------------------------------------------------------------------------//
  49.  
  50. public OnFilterScriptInit()
  51. {
  52.     BombCount = TextDrawCreate(270.000000, 397.000000, "00:00:00");
  53.     TextDrawBackgroundColor(BombCount, 255);
  54.     TextDrawFont(BombCount, 2);
  55.     TextDrawLetterSize(BombCount, 0.500000, 2.199999);
  56.     TextDrawColor(BombCount, -1);
  57.     TextDrawSetOutline(BombCount, 1);
  58.     TextDrawSetProportional(BombCount, 1);
  59.     return 1;
  60. }
  61.  
  62.  
  63.  
  64. public OnPlayerCommandText(playerid, cmdtext[])
  65. {
  66.  
  67.     if(strcmp(cmdtext, "/bomba", true) == 0)
  68.     {
  69.         if(PlantouBomba[playerid] == 1) return SendClientMessage(playerid, Amarelo, " Você já plantou uma bomba. ");
  70.  
  71.         else
  72.         {
  73.             bombplanttime = SetTimerEx("BombPlantTime", ARMARTEMPO*1000, 0, "d", playerid);
  74.             ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 1, 0, 0, 0, 0);
  75.             PlantouBomba[playerid] = 1;
  76.             return 1;
  77.         }
  78.     }
  79.  
  80.     return 0;
  81. }
  82.  
  83.  
  84. public BombPlantTime(playerid)
  85. {
  86.     GetPlayerPos(playerid, BombX, BombY, BombZ);
  87.     BombaRelogio[playerid] = CreateObject(1252, BombX, BombY, BombZ-0.80, 270, 0, 0);
  88.     TogglePlayerControllable(playerid, 1);
  89.     ClearAnimations(playerid);
  90.     bombtime = SetTimerEx("BombTime", 9, 1, "d", playerid);
  91.     MS[playerid] = 99;
  92.     Segundos[playerid] = BOMBATEMPO;
  93.     TextDrawShowForAll(Text:BombCount);
  94.     KillTimer(bombplanttime);
  95.     return 1;
  96.  
  97. }
  98.  
  99. public BombTime(playerid)
  100. {
  101.     MS[playerid]--;
  102.     if(MS[playerid] == 0)
  103.     {
  104.         MS[playerid] = 99;
  105.         Segundos[playerid]--;
  106.     }
  107.  
  108.     if(Segundos[playerid] > 60)
  109.     {
  110.         new Segundos2 = Segundos[playerid] - 60;
  111.         Segundos[playerid] = Segundos2;
  112.         Minutos[playerid]++;
  113.     }
  114.  
  115.     if(Segundos[playerid] == 0 && Minutos[playerid] > 0)
  116.     {
  117.         Segundos[playerid] = 59;
  118.         Minutos[playerid]--;
  119.     }
  120.  
  121.     if(Segundos[playerid] == 0 && MS[playerid] == 1)
  122.     {
  123.         PlantouBomba[playerid] = 0;
  124.         TextDrawHideForAll(Text:BombCount);
  125.         DestroyObject(BombaRelogio[playerid]);
  126.  
  127.         CreateExplosion(BombX, BombY + random(8), BombZ + random(5), 6, 10.0);
  128.         CreateExplosion(BombX + random(8), BombY, BombZ + random(5), 6, 10.0);
  129.         CreateExplosion(BombX, BombY, BombZ, 6, 10.0);
  130.         CreateExplosion(BombX, BombY - random(8), BombZ + random(5), 6, 10.0);
  131.         CreateExplosion(BombX - random(8), BombY, BombZ + random(5), 6, 10.0);
  132.  
  133.         KillTimer(bombtime);
  134.     }
  135.  
  136.     if(Segundos[playerid] < 10)
  137.     {
  138.         new count[10];
  139.         format(count, sizeof(count), "00:0%i:%i", Segundos[playerid], MS[playerid]);
  140.         TextDrawSetString(BombCount, count);
  141.     }
  142.  
  143.     if(Segundos[playerid] >= 10)
  144.     {
  145.         new count[10];
  146.         format(count, sizeof(count), "00:%i:%i", Segundos[playerid], MS[playerid]);
  147.         TextDrawSetString(BombCount, count);
  148.     }
  149.  
  150.     if(Minutos[playerid] < 10 && Segundos[playerid] < 10)
  151.     {
  152.         new count[10];
  153.         format(count, sizeof(count), "0%i:0%i:%i",Minutos[playerid], Segundos[playerid], MS[playerid]);
  154.         TextDrawSetString(BombCount, count);
  155.     }
  156.  
  157.     if(Minutos[playerid] < 10 && Segundos[playerid] > 9)
  158.     {
  159.         new count[10];
  160.         format(count, sizeof(count), "0%i:%i:%i",Minutos[playerid], Segundos[playerid], MS[playerid]);
  161.         TextDrawSetString(BombCount, count);
  162.     }
  163.  
  164.     if(Minutos[playerid] >= 10 && Segundos[playerid] > 9)
  165.     {
  166.         new count[10];
  167.         format(count, sizeof(count), "%i:%i:%i",Minutos[playerid], Segundos[playerid], MS[playerid]);
  168.         TextDrawSetString(BombCount, count);
  169.     }
  170.  
  171.     if(Minutos[playerid] >= 10 && Segundos[playerid] < 10)
  172.     {
  173.         new count[10];
  174.         format(count, sizeof(count), "%i:0%i:%i",Minutos[playerid], Segundos[playerid], MS[playerid]);
  175.         TextDrawSetString(BombCount, count);
  176.     }
  177.  
  178.  
  179.     return 1;
  180. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement