Guest User

[FilterScript] - @rInvasão ao Departamento de Polícia(DP)

a guest
Sep 1st, 2012
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 9.38 KB | None | 0 0
  1. /*
  2. =============================================
  3. - Sistema, explosão de celas.
  4. - @Riichard/Remix
  5. - Skype:
  6.     - Riichard.Amp
  7. =============================================
  8. */
  9.  
  10. #include             <a_samp> // SAMP-TEAM
  11. #include             <zcmd> // Zeex
  12. #include             <DOF2> // Double-O-Seven
  13. #include             <sscanf2> // Y_Less
  14.  
  15. #define Cela         10000 // Troque o tempo.
  16. #define Explodir     5000  // Troque o tempo.
  17. #define Plantando    3000  // Troque o tempo.
  18. #define GameText     5000  // Troque o tempo.
  19.  
  20. #define TresBombas      3400     // Preço
  21. #define NoveBombas      7800   // Preço
  22. #define QuinzeBombas    12300  //Preço
  23.  
  24. #define DialogBomba     871  // Dialogid
  25.  
  26. #define PastaBomba      "rBombas/%s.ini"
  27.  
  28. new
  29.        String[100],
  30.        rNome[MAX_PLAYER_NAME],
  31.        rNome2[MAX_PLAYER_NAME],
  32.        Bombinha,
  33.        BombaTemp[MAX_PLAYERS],
  34.        BombaTemp2[MAX_PLAYERS],
  35.        RetornoCela,
  36.        BombaTemp3[MAX_PLAYERS],
  37.        TempoBomba[MAX_PLAYERS],
  38.        Bombas[MAX_PLAYERS],
  39.        bool:CelaOff,
  40.        Float: X,
  41.        Float: Y,
  42.        Float: Z
  43. ;
  44.  
  45. public OnFilterScriptInit()
  46. {
  47.     print("\n---------------------------------------------------------");
  48.     print("  [FilterScript]@rInvasão ao Departamento de Polica");
  49.     print("  [FilterScript]By: @Riichard - Idéia: #Coringa     ");
  50.     print("---------------------------------------------------------\n");
  51.     return 1;
  52. }
  53.  
  54. public OnFilterScriptExit()
  55. {
  56.     for (new r = 0; r != MAX_PLAYERS; r++)
  57.     {
  58.         if(IsPlayerConnected(r))
  59.         {
  60.                 SalvarBombas(r);
  61.         }
  62.     }
  63.     print("\n---------------------------------------------------------");
  64.     print("  [FilterScript]@rInvasão ao Departamento de Polica");
  65.     print("  [FilterScript]By: @Riichard - Idéia: #Coringa     ");
  66.     print("---------------------------------------------------------\n");
  67.     DOF2_Exit();
  68.     return 1;
  69. }
  70.  
  71. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  72. {
  73.     if(dialogid == DialogBomba)
  74.     {
  75.         if(response)
  76.         {
  77.             if(listitem == 0)
  78.             {
  79.                   if(GetPlayerMoney(playerid) < TresBombas) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Dinheiro insuficiente."); // Se Ele Não Tiver Dinheiro, Não Pode Comprar
  80.                   GivePlayerMoney(playerid, -TresBombas); // Para Tirar Dinheiro Ao Jogador
  81.                   format(String, sizeof(String), "[rINFO] 3 Bombas Compradas. Valor: %d", TresBombas);
  82.                   SendClientMessage(playerid, 0x00FF00AA, String);
  83.                   Bombas[playerid] = 3;
  84.             }
  85.             if (listitem == 1)
  86.             {
  87.                   if(GetPlayerMoney(playerid) < NoveBombas) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Dinheiro insuficiente."); // Se Ele Não Tiver Dinheiro, Não Pode Comprar
  88.                   GivePlayerMoney(playerid, -NoveBombas); // Para Tirar Dinheiro Ao Jogador
  89.                   format(String, sizeof(String), "[rINFO] 9 Bombas Compradas. Valor: %d", NoveBombas);
  90.                   SendClientMessage(playerid, 0x00FF00AA, String);
  91.                   Bombas[playerid] = 9;
  92.             }
  93.             if (listitem == 2)
  94.             {
  95.                   if(GetPlayerMoney(playerid) < QuinzeBombas) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Dinheiro insuficiente."); // Se Ele Não Tiver Dinheiro, Não Pode Comprar
  96.                   GivePlayerMoney(playerid, -QuinzeBombas); // Para Tirar Dinheiro Ao Jogador
  97.                   format(String, sizeof(String), "[rINFO] 15 Bombas Compradas. Valor: %d", QuinzeBombas);
  98.                   SendClientMessage(playerid, 0x00FF00AA, String);
  99.                   Bombas[playerid] = 15;
  100.             }
  101.         }
  102.     }
  103.     return 0;
  104. }
  105.  
  106. public OnPlayerDisconnect(playerid, reason)
  107. {
  108.     if(TempoBomba[playerid] > 0)
  109.     {
  110.          DestroyObject(Bombinha);
  111.          KillTimer(BombaTemp[playerid]);
  112.     }
  113.     SalvarBombas(playerid);
  114.     return 0;
  115. }
  116.  
  117. public OnPlayerConnect(playerid)
  118. {
  119.     Bombas[playerid] = 0;
  120.     CarregarBombas(playerid);
  121.     return 0;
  122. }
  123.      
  124.  
  125. /*CMD:irdp(playerid)
  126. {
  127.     SetPlayerPos(playerid, 246.783996,63.900199,1003.640625);
  128.     SetPlayerInterior(playerid, 6);
  129.     return 1;
  130. }*/
  131.  
  132. CMD:comprarbomba(playerid)
  133. {
  134.    if(Bombas[playerid] > 0) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Você já contém bombas.");
  135.    ShowPlayerDialog(playerid, DialogBomba, DIALOG_STYLE_LIST, "[rBombas] - Escolha a quantidade:", "{4876FF}3 Bombas - {FFFFFF}R$3,400\n{4876FF}9 Bombas - {FFFFFF}R$7,800\n{4876FF}15 Bombas - {FFFFFF}R$12,300", "Comprar", "Cancelar");
  136.    return 1;
  137. }
  138.  
  139. CMD:bomba(playerid)
  140. {
  141.     if(TempoBomba[playerid] > 0) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Você já plantou a bomba.");
  142.     if(Bombas[playerid] < 1) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Você não tem bomba, use: /comprarbomba.");
  143.     if(CelaOff == true) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Aguarde... Acabou de aconteçer uma invasão!");
  144.     if(IsPlayerInRangeOfPoint(playerid, 3.0, 267.4290,81.1470,1001.0391))
  145.     {
  146.         TogglePlayerControllable(playerid, false);
  147.         Bombas[playerid] --;
  148.         ClearAnimations(playerid);
  149.         ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 1, 1, 1, 1, 1);
  150.         GetPlayerPos(playerid, X, Y, Z);
  151.         Bombinha = CreateObject(1654, X, Y+0.1, Z-0.8, 0.0, 0.0, 0.0);
  152.         BombaTemp[playerid] = SetTimerEx("Terminar", Plantando, true, "d", playerid);
  153.         GetPlayerName(playerid, rNome, MAX_PLAYER_NAME);
  154.         format(String, sizeof(String), "[rBomba] %s plantou uma bomba, saiam de perto!", rNome);
  155.         for (new r = 0; r != MAX_PLAYERS; r++)
  156.         {
  157.            if (IsPlayerInRangeOfPoint(r, 10.0, X, Y, Z))
  158.            {
  159.               SendClientMessage(r, 0xFF0000AA, String);
  160.            }
  161.         }
  162.     }else{
  163.         SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Você não está perto das celas.");
  164.     }
  165.     return 1;
  166. }
  167.  
  168. CMD:infobomba(playerid)
  169. {
  170.    format(String, sizeof(String), "[rBombas] Você contém %d bomba(s).", Bombas[playerid]);
  171.    SendClientMessage(playerid, 0x4876FFAA, String);
  172.    return 1;
  173. }
  174.  
  175. CMD:darbomba(playerid, params[])
  176. {
  177.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Você não é administrador rcon.");
  178.     new ID, Quantia;
  179.     if(sscanf(params, "ud", ID, Quantia)) return SendClientMessage(playerid, 0x4876FFAA, "[rINFO] Use: /DarBomba [playerid] [bombas]");
  180.     if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Jogador não está conectado.");
  181.     if(Quantia < 0 || Quantia > 100) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Você só pode dar bombas de 0 á 100.");
  182.     if(Bombas[ID] == Quantia) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] O Jogador já contém a quantia de bombas.");
  183.     GetPlayerName(playerid, rNome, MAX_PLAYER_NAME);
  184.     GetPlayerName(ID, rNome2, MAX_PLAYER_NAME);
  185.     format(String, sizeof(String), "[INFO] O Administrador, %s, te deu %d bombas.", rNome, Quantia);
  186.     SendClientMessage(ID, 0x4876FFAA, String);
  187.     format(String, sizeof(String), "[INFO] Você setou %d bombas, para %s.", Quantia, rNome2);
  188.     SendClientMessage(playerid, 0x4876FFAA, String);
  189.     Bombas[playerid] = Quantia;
  190.     return 1;
  191. }
  192.  
  193. forward Terminar(playerid);
  194. public Terminar(playerid)
  195. {
  196.    TogglePlayerControllable(playerid, true);
  197.    ClearAnimations(playerid);
  198.    ClearAnimations(playerid);
  199.    KillTimer(BombaTemp[playerid]);
  200.    BombaTemp2[playerid] = SetTimerEx("ExplodirCela", Explodir, true, "d", playerid);
  201.    TempoBomba[playerid] = 5;
  202.    BombaTemp3[playerid] = SetTimerEx("BombaTempo", GameText, true, "d", playerid);
  203.    return 1;
  204. }
  205.  
  206. forward BombaTempo(playerid);
  207. public BombaTempo(playerid)
  208. {
  209.     TempoBomba[playerid] --;
  210.     format(String, sizeof(String), "~y~~h~%d", TempoBomba[playerid]);
  211.     GameTextForPlayer(playerid, String, 2000, 3);
  212.     return 1;
  213. }
  214.  
  215. forward ExplodirCela(playerid);
  216. public ExplodirCela(playerid)
  217. {
  218.     KillTimer(BombaTemp2[playerid]);
  219.     KillTimer(BombaTemp3[playerid]);
  220.     GetObjectPos(Bombinha, X, Y, Z);
  221.     DestroyObject(Bombinha);
  222.     CreateExplosion(X, Y, Z, 9, 2.0);
  223.     TempoBomba[playerid] = 0;
  224.     for (new r = 0; r != MAX_PLAYERS; r++)
  225.     {
  226.         if(IsPlayerConnected(r))
  227.         {
  228.             RemoveBuildingForPlayer(r, 14843, 266.3516, 81.1953, 1001.2813, 0.25);
  229.             if (IsPlayerInRangeOfPoint(r, 10.0, X, Y, Z))
  230.             {
  231.                 SendClientMessage(r, 0xFF0000AA, "[AVISO] Fujá dai! Você tem apenas 10 segundos.");
  232.             }
  233.         }
  234.     }
  235.     RetornoCela = SetTimer("CelaRetorno", Cela, true);
  236.     CelaOff = true;
  237.     return 1;
  238. }
  239.  
  240. forward CelaRetorno();
  241. public CelaRetorno()
  242. {
  243.     KillTimer(RetornoCela);
  244.     CreateObject(14843, 266.27, 81.20, 1001.26,   0.00, 0.00, 89.47);
  245.     CelaOff = false;
  246. }
  247.  
  248. stock SalvarBombas(playerid)
  249. {
  250.     new Files[42];
  251.     GetPlayerName(playerid, rNome, MAX_PLAYER_NAME);
  252.     format(Files, sizeof(Files), PastaBomba, rNome);
  253.     DOF2_CreateFile(Files);
  254.     DOF2_SetInt(Files, "Bombas", Bombas[playerid]);
  255.     DOF2_SaveFile();
  256.     return 1;
  257. }
  258.  
  259. stock CarregarBombas(playerid)
  260. {
  261.     new Files[42];
  262.     GetPlayerName(playerid, rNome, MAX_PLAYER_NAME);
  263.     format(Files, sizeof(Files), PastaBomba, rNome);
  264.     Bombas[playerid] = DOF2_GetInt(Files, "Bombas");
  265.     return 1;
  266. }
Advertisement
Add Comment
Please, Sign In to add comment