Advertisement
Guest User

Untitled

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