Advertisement
Paulo_AttacK

Explosão de Caixas Eletronicos v2.1

Jan 8th, 2012
3,804
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.93 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. //
  4. //        #### ########   ######     ######## ########    ###    ##     ##
  5. //         ##  ##     ## ##    ##       ##    ##         ## ##   ###   ###
  6. //         ##  ##     ## ##             ##    ##        ##   ##  #### ####
  7. //         ##  ########   ######        ##    ######   ##     ## ## ### ##
  8. //         ##  ##              ##       ##    ##       ######### ##     ##
  9. //         ##  ##        ##    ##       ##    ##       ##     ## ##     ##
  10. //        #### ##         ######        ##    ######## ##     ## ##     ##
  11. //
  12. //
  13. //                      Explosão de Caixas Eletronicos v2.1
  14. //
  15. /*                   ______          ______           _
  16. //                   | ___ \         | ___ \         | |
  17. //                   | |_/ /_   _    | |_/ /_ _ _   _| | ___
  18. //                   | ___ \ | | |   |  __/ _` | | | | |/ _ \
  19. //                   | |_/ / |_| |_  | | | (_| | |_| | | (_) |
  20. //                   \____/ \__, (_) \_|  \__,_|\__,_|_|\___/
  21. //                           __/ |
  22. //                          |___/
  23. */
  24. //
  25. //     !!!   Simule a vida real expldindo os Caixas Eletronicos pela cidade   !!!
  26. //
  27. //          [iPs]TeaM soluções de programação em geral (agora com cursos)
  28. //
  29. //                  http://ips-team.forumeiros.com/ (contate-nos)
  30. //
  31. /////////////////////////////////////////////////////////////////////////////////
  32.  
  33. #include        <a_samp>
  34. #include        <bcmd>
  35.  
  36. #define MAX_CAIXAS 50
  37. #define Function%0(%1) forward%0(%1); public%0(%1)
  38.  
  39. new Caixa[5];
  40.  
  41. new bool: CaixaExplodido[MAX_CAIXAS];
  42. new bool: VaiExplodir[MAX_CAIXAS];
  43.  
  44. new Float: EfX[MAX_CAIXAS] = { 1155.27, 377.80, 1508.32, 2243.00, 1833.20 };
  45. new Float: EfY[MAX_CAIXAS] = { -1463.80, -2056.45, -1676.96, -1665.09, -1840.21 };
  46. new Float: EfZ[MAX_CAIXAS] = { 15.42, 7.66, 13.70, 15.14, 13.24 };
  47. new Float: EfrX[MAX_CAIXAS] = { 0.00, 0.00, 0.00, 0.00, 0.00 };
  48. new Float: EfrY[MAX_CAIXAS] = { 0.00, 0.00, 0.00, 0.00, 0.00 };
  49. new Float: EfrZ[MAX_CAIXAS] = { -69.00, 180.00, 113.00, 164.00, 270.00 };
  50.  
  51. new Pickup[MAX_CAIXAS] = {0xFFFF, ...};
  52.  
  53. public OnFilterScriptInit()
  54. {
  55.     print("\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
  56.     print("|                                            |");
  57.     print("|    » Explodir Caixas By. Paulo_TerroR «    |");
  58.     print("|                                            |");
  59.     print("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
  60.     for(new i = (sizeof(Caixa) - 1); i > -1; --i) Caixa[i] = CreateObject(2942, EfX[i], EfY[i], EfZ[i], EfrX[i], EfrY[i], EfrZ[i]);
  61.     return 1;
  62. }
  63.  
  64. public OnFilterScriptExit()
  65. {
  66.     print("\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
  67.     print("|                                            |");
  68.     print("|    » Explodir Caixas By. Paulo_TerroR «    |");
  69.     print("|                                            |");
  70.     print("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
  71.     for(new i = (sizeof(Caixa) - 1); i > -1; --i) DestroyObject(Caixa[i]);
  72.     return 1;
  73. }
  74.  
  75. public OnPlayerPickUpPickup(playerid, pickupid) {
  76.     new ExpID = GetProxExp(playerid);
  77.     if(Pickup[ExpID] == pickupid) {
  78.         new GranaExp = randomEx(500, 1000), Str[55];
  79.         format(Str, 55, "INFO: Você recebeu R$ %i,00 pela Explosão do Caixa!", GranaExp);
  80.         SendClientMessage(playerid, 0x33AA33AA, Str);
  81.         GivePlayerMoney(playerid, GranaExp);
  82.         DestroyPickup(Pickup[ExpID]);
  83.         Pickup[ExpID] = 0xFFFF;
  84.     }
  85.     return 1;
  86. }
  87.  
  88. Function ConstruirCaixa(ExpID) {
  89.     DestroyObject(Caixa[ExpID]);
  90.     CaixaExplodido[ExpID] = false;
  91.     Caixa[ExpID] = CreateObject(2942, EfX[ExpID], EfY[ExpID], EfZ[ExpID], EfrX[ExpID], EfrY[ExpID], EfrZ[ExpID]);
  92.     return 1;
  93. }
  94.  
  95. Function InfoCaixas(playerid, Float: fX, Float: fY, Float: fZ, Obj, ExpID) {
  96.     CreateExplosion(fX, fY, fZ, 10, 2000.0);
  97.     DestroyObject(Obj);
  98.     DestroyObject(Caixa[ExpID]);
  99.     Caixa[ExpID] = CreateObject(2943, EfX[ExpID], EfY[ExpID], EfZ[ExpID], EfrX[ExpID], EfrY[ExpID], EfrZ[ExpID]);
  100.     SetTimerEx("ConstruirCaixa", (15 * 60000), false, "i", ExpID);
  101.    
  102.     if(IsPlayerInRangeOfPoint(playerid, 30.0, EfX[ExpID], EfY[ExpID], EfZ[ExpID])) {
  103.         SendClientMessage(playerid, 0x33AA33AA, "[SUCESSO] Você explodiu o caixa, vá até ele e pegue sua Recompensa!");
  104.         CaixaExplodido[ExpID] = true;
  105.         VaiExplodir[ExpID] = false;
  106.        
  107.         Pickup[ExpID] = CreatePickup(1279, 1, fX, (fY + 0.4), (fZ - 0.55));
  108.     } else {
  109.         SendClientMessage(playerid, 0xAA3333AA,"[ERRO] Você se distanciou do caixa!.");
  110.         CaixaExplodido[ExpID] = true;
  111.         VaiExplodir[ExpID] = false;
  112.     }
  113.     return 1;
  114. }
  115.  
  116. GetProxExp(playerid) {
  117.     for(new i = (sizeof(Caixa) - 1); i > -1; --i) if(IsPlayerInRangeOfPoint(playerid, 5.0, EfX[i], EfY[i], EfZ[i])) return i;
  118.     return 0xFFFF;
  119. }
  120.  
  121. randomEx(Min, Max) return (random(((Max - Min) + 1)) + Min);
  122.  
  123. bCMD[explodircaixa]>(playerid : params[] : help) {
  124.     new Float: pfX, Float: pfY, Float: pfZ;
  125.     for(new i = (sizeof(Caixa) - 1); i > -1; --i) {
  126.         if(IsPlayerInRangeOfPoint(playerid, 2.0, EfX[i], EfY[i], EfZ[i])) {
  127.             if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xAA3333AA, "[ERRO] Você não pode usar esse comando em um veiculo!.");
  128.             if(CaixaExplodido[i]) return SendClientMessage(playerid, 0xAA3333AA, "[ERRO] O caixa foi explodido a pouco tempo.");
  129.             if(VaiExplodir[i]) return SendClientMessage(playerid, 0xAA3333AA, "[ERRO] O caixa já vai explodir.");
  130.  
  131.             GetPlayerPos(playerid, pfX, pfY, pfZ);
  132.             SetTimerEx("InfoCaixas", 10000, false, "ifffii", playerid, pfX, pfY, pfZ, CreateObject(1654, pfX, (pfY + 0.4), (pfZ - 0.8), 0, 0, 0), i);
  133.             SendClientMessage(playerid, 0xFFFF00AA, "Você armou a dinamite! Saia de perto rápido!!");
  134.             SetPlayerWantedLevel(playerid, (GetPlayerWantedLevel(playerid) + 1));
  135.             VaiExplodir[i] = true;
  136.             return ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
  137.         }
  138.     }
  139.     return SendClientMessage(playerid, 0xAA3333AA, "[ERRO] Você não está em nenhum perto de um caixa eletronico.");
  140.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement