Advertisement
Chip7

[FS] FilterScript @rInvasão ao DP

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