[FilterScript] @rInvasгo ao DP
#1


Invasгo ao Departamento de Polнcia(DP)

LEIA ANTES DE POSTAR!


@ Descriзгo:
Bom, eu estavб, sem oque fazer... E esses dias o #Coringa, me deu uma idйia...
Explodir a Cela do Departamento de Polнcia(DP).
Fiquei pensando, se ficaria legal ou nгo... Ai hoje, resolvi cria-lo para ver como ficou...

Em minha opniгo acho que ficou legalzinho .

Acredito que sejб ъtil, em servidores de RP/G ou atй mesmo DM/TDM.
So basta adapta-lo ao seu GameMode.

O FilterScript й simples, ao passar dos dias, irйi colocar atualizar algumas coisas.
  • FilterScript:

    Contйm 264 linhas.
    Contйm Salvamento DOF2 (Necessбrio criar pasta rBombas)
    Contйm Comando de Dar Bomba (Necessбrio ser Admin Rcon)

  • Includes Usadas:

    DOF2 // Double-O-Seven
    ZCMD // Zeex
    SSCANF2 // ******
    A_SAMP // SAMP-TEAM

  • Comandos:

    /InfoBomba // Quantidade de Bombas Sobrando
    /ComprarBomba // Comprar Bombas
    /Bomba // Plantar a Bomba(Perto das celas)
    /DarBomba // Dar Bombas ao Jogador(Somente Rcon)

  • Prints:

    /ComprarBomba


    Outros...


  • Dica:

    Vocк pode alterar o tempo da explosгo, retorno das celas, entre outros.
    Basta ir atй:

    pawn Code:
    #define Cela         10000 // Troque o tempo.
    #define Explodir     5000  // Troque o tempo.
    #define Plantando    3000  // Troque o tempo.
    #define GameText     5000  // Troque o tempo.
    E mudar os nъmeros.

    Vocк pode alterar tambйm os preзos das bombas.
    Basta ir atй:
    pawn Code:
    #define TresBombas      3400     // Preзo
    #define NoveBombas      7800   // Preзo
    #define QuinzeBombas    12300  //Preзo
    E mudar os nъmeros

    Onde estб
    pawn Code:
    #define DialogBomba     871  // Dialogid
    Tenha cuidado, com conflitos de dialogs.

    Se quiser mudar nome da pasta, basta ir atй:
    pawn Code:
    #define PastaBomba      "rBombas/%s.ini"
    E mudar: rBombas, para a pasta desejada.

  • Vнdeo:

    [ame]http://www.youtube.com/watch?v=0oZRD0Ee9Cg[/ame]

  • Download:

    pawn Code:
    /*
    =============================================
    - Sistema, explosгo de celas.
    - @Riichard
    =============================================
    */


    #include             <a_samp> // SAMP-TEAM
    #include             <zcmd> // Zeex
    #include             <DOF2> // Double-O-Seven
    #include             <sscanf2> // ******

    #define Cela         10000 // Troque o tempo.
    #define Explodir     5000  // Troque o tempo.
    #define Plantando    3000  // Troque o tempo.
    #define GameText     5000  // Troque o tempo.

    #define TresBombas      3400     // Preзo
    #define NoveBombas      7800   // Preзo
    #define QuinzeBombas    12300  //Preзo

    #define DialogBomba     871  // Dialogid

    #define PastaBomba      "rBombas/%s.ini"

    new
           String[100],
           rNome[MAX_PLAYER_NAME],
           rNome2[MAX_PLAYER_NAME],
           Bombinha,
           BombaTemp[MAX_PLAYERS],
           BombaTemp2[MAX_PLAYERS],
           RetornoCela,
           BombaTemp3[MAX_PLAYERS],
           TempoBomba[MAX_PLAYERS],
           Bombas[MAX_PLAYERS],
           bool:CelaOff,
           Float: X,
           Float: Y,
           Float: Z
    ;

    public OnFilterScriptInit()
    {
        print("\n---------------------------------------------------------");
        print("  [FilterScript]@rInvasгo ao Departamento de Polica");
        print("  [FilterScript]By: @Riichard - Idйia: #Coringa     ");
        print("---------------------------------------------------------\n");
        return 1;
    }

    public OnFilterScriptExit()
    {
        for (new r = 0; r != MAX_PLAYERS; r++)
        {
            if(IsPlayerConnected(r))
            {
                    SalvarBombas(r);
            }
        }
        print("\n---------------------------------------------------------");
        print("  [FilterScript]@rInvasгo ao Departamento de Polica");
        print("  [FilterScript]By: @Riichard - Idйia: #Coringa     ");
        print("---------------------------------------------------------\n");
        DOF2_Exit();
        return 1;
    }

    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
        if(dialogid == DialogBomba)
        {
            if(response)
            {
                if(listitem == 0)
                {
                      if(GetPlayerMoney(playerid) < TresBombas) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Dinheiro insuficiente."); // Se Ele Nгo Tiver Dinheiro, Nгo Pode Comprar
                      GivePlayerMoney(playerid, -TresBombas); // Para Tirar Dinheiro Ao Jogador
                      format(String, sizeof(String), "[rINFO] 3 Bombas Compradas. Valor: %d", TresBombas);
                      SendClientMessage(playerid, 0x00FF00AA, String);
                      Bombas[playerid] = 3;
                }
                if (listitem == 1)
                {
                      if(GetPlayerMoney(playerid) < NoveBombas) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Dinheiro insuficiente."); // Se Ele Nгo Tiver Dinheiro, Nгo Pode Comprar
                      GivePlayerMoney(playerid, -NoveBombas); // Para Tirar Dinheiro Ao Jogador
                      format(String, sizeof(String), "[rINFO] 9 Bombas Compradas. Valor: %d", NoveBombas);
                      SendClientMessage(playerid, 0x00FF00AA, String);
                      Bombas[playerid] = 9;
                }
                if (listitem == 2)
                {
                      if(GetPlayerMoney(playerid) < QuinzeBombas) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Dinheiro insuficiente."); // Se Ele Nгo Tiver Dinheiro, Nгo Pode Comprar
                      GivePlayerMoney(playerid, -QuinzeBombas); // Para Tirar Dinheiro Ao Jogador
                      format(String, sizeof(String), "[rINFO] 15 Bombas Compradas. Valor: %d", QuinzeBombas);
                      SendClientMessage(playerid, 0x00FF00AA, String);
                      Bombas[playerid] = 15;
                }
            }
        }
        return 0;
    }

    public OnPlayerDisconnect(playerid, reason)
    {
        if(TempoBomba[playerid] > 0)
        {
             DestroyObject(Bombinha);
             KillTimer(BombaTemp[playerid]);
        }
        SalvarBombas(playerid);
        return 0;
    }

    public OnPlayerConnect(playerid)
    {
        Bombas[playerid] = 0;
        CarregarBombas(playerid);
        return 0;
    }
         

    /*CMD:irdp(playerid)
    {
        SetPlayerPos(playerid, 246.783996,63.900199,1003.640625);
        SetPlayerInterior(playerid, 6);
        return 1;
    }*/


    CMD:comprarbomba(playerid)
    {
       if(Bombas[playerid] > 0) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Vocк jб contйm bombas.");
       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");
       return 1;
    }

    CMD:bomba(playerid)
    {
        if(TempoBomba[playerid] > 0) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Vocк jб plantou a bomba.");
        if(Bombas[playerid] < 1) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Vocк nгo tem bomba, use: /comprarbomba.");
        if(CelaOff == true) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Aguarde... Acabou de aconteзer uma invasгo!");
        if(IsPlayerInRangeOfPoint(playerid, 3.0, 267.4290,81.1470,1001.0391))
        {
            TogglePlayerControllable(playerid, false);
            Bombas[playerid] --;
            ClearAnimations(playerid);
            ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 1, 1, 1, 1, 1);
            GetPlayerPos(playerid, X, Y, Z);
            Bombinha = CreateObject(1654, X, Y+0.1, Z-0.8, 0.0, 0.0, 0.0);
            BombaTemp[playerid] = SetTimerEx("Terminar", Plantando, true, "d", playerid);
            GetPlayerName(playerid, rNome, MAX_PLAYER_NAME);
            format(String, sizeof(String), "[rBomba] %s plantou uma bomba, saiam de perto!", rNome);
            for (new r = 0; r != MAX_PLAYERS; r++)
            {
               if (IsPlayerInRangeOfPoint(r, 10.0, X, Y, Z))
               {
                  SendClientMessage(r, 0xFF0000AA, String);
               }
            }
        }else{
            SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Vocк nгo estб perto das celas.");
        }
        return 1;
    }

    CMD:infobomba(playerid)
    {
       format(String, sizeof(String), "[rBombas] Vocк contйm %d bomba(s).", Bombas[playerid]);
       SendClientMessage(playerid, 0x4876FFAA, String);
       return 1;
    }

    CMD:darbomba(playerid, params[])
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Vocк nгo й administrador rcon.");
        new ID, Quantia;
        if(sscanf(params, "ud", ID, Quantia)) return SendClientMessage(playerid, 0x4876FFAA, "[rINFO] Use: /DarBomba [playerid] [bombas]");
        if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Jogador nгo estб conectado.");
        if(Quantia < 0 || Quantia > 100) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] Vocк sу pode dar bombas de 0 б 100.");
        if(Bombas[ID] == Quantia) return SendClientMessage(playerid, 0xA9A9A9AA, "[ERRO] O Jogador jб contйm a quantia de bombas.");
        GetPlayerName(playerid, rNome, MAX_PLAYER_NAME);
        GetPlayerName(ID, rNome2, MAX_PLAYER_NAME);
        format(String, sizeof(String), "[INFO] O Administrador, %s, te deu %d bombas.", rNome, Quantia);
        SendClientMessage(ID, 0x4876FFAA, String);
        format(String, sizeof(String), "[INFO] Vocк setou %d bombas, para %s.", Quantia, rNome2);
        SendClientMessage(playerid, 0x4876FFAA, String);
        Bombas[playerid] = Quantia;
        return 1;
    }

    forward Terminar(playerid);
    public Terminar(playerid)
    {
       TogglePlayerControllable(playerid, true);
       ClearAnimations(playerid);
       ClearAnimations(playerid);
       KillTimer(BombaTemp[playerid]);
       BombaTemp2[playerid] = SetTimerEx("ExplodirCela", Explodir, true, "d", playerid);
       TempoBomba[playerid] = 5;
       BombaTemp3[playerid] = SetTimerEx("BombaTempo", GameText, true, "d", playerid);
       return 1;
    }

    forward BombaTempo(playerid);
    public BombaTempo(playerid)
    {
        TempoBomba[playerid] --;
        format(String, sizeof(String), "~y~~h~%d", TempoBomba[playerid]);
        GameTextForPlayer(playerid, String, 2000, 3);
        return 1;
    }

    forward ExplodirCela(playerid);
    public ExplodirCela(playerid)
    {
        KillTimer(BombaTemp2[playerid]);
        KillTimer(BombaTemp3[playerid]);
        GetObjectPos(Bombinha, X, Y, Z);
        DestroyObject(Bombinha);
        CreateExplosion(X, Y, Z, 9, 2.0);
        TempoBomba[playerid] = 0;
        for (new r = 0; r != MAX_PLAYERS; r++)
        {
            if(IsPlayerConnected(r))
            {
                RemoveBuildingForPlayer(r, 14843, 266.3516, 81.1953, 1001.2813, 0.25);
                if (IsPlayerInRangeOfPoint(r, 10.0, X, Y, Z))
                {
                    SendClientMessage(r, 0xFF0000AA, "[AVISO] Fujб dai! Vocк tem apenas 10 segundos.");
                }
            }
        }
        RetornoCela = SetTimer("CelaRetorno", Cela, true);
        CelaOff = true;
        return 1;
    }

    forward CelaRetorno();
    public CelaRetorno()
    {
        KillTimer(RetornoCela);
        CreateObject(14843, 266.27, 81.20, 1001.26,   0.00, 0.00, 89.47);
        CelaOff = false;
    }

    stock SalvarBombas(playerid)
    {
        new Files[42];
        GetPlayerName(playerid, rNome, MAX_PLAYER_NAME);
        format(Files, sizeof(Files), PastaBomba, rNome);
        DOF2_CreateFile(Files);
        DOF2_SetInt(Files, "Bombas", Bombas[playerid]);
        DOF2_SaveFile();
        return 1;
    }

    stock CarregarBombas(playerid)
    {
        new Files[42];
        GetPlayerName(playerid, rNome, MAX_PLAYER_NAME);
        format(Files, sizeof(Files), PastaBomba, rNome);
        Bombas[playerid] = DOF2_GetInt(Files, "Bombas");
        return 1;
    }

  • Crйditos:

    @Riichard // FilterScript
    #Coringa // Idйia

    Agradecimento aos criadores das includes.

  • Bug/Erro/Sugestгo/Divulgaзгo:

    Acredito que tenha alguns bugs... Pois testei sozinho!
    Erros/Warning nem um.

    Aceito sugestхes.
    Pode postar em seu site/blog/forum, portanto que deixe os devidos crйditos.

  • Por ser um FilterScript simples, espero que gostem .
Reply


Messages In This Thread
@rInvasгo ao DP - by @Riichard - 01.09.2012, 01:19
Re: @rInvasгo ao DP - by Bruno Alves - 01.09.2012, 01:20
Re: @rInvasгo ao DP - by Q.I - 01.09.2012, 01:27
Re: @rInvasгo ao DP - by Math3us - 01.09.2012, 01:30
Re: @rInvasгo ao DP - by @Riichard - 01.09.2012, 01:30
Re: @rInvasгo ao DP - by leonardo1434 - 01.09.2012, 01:34
Re: @rInvasгo ao DP - by Q.I - 01.09.2012, 01:34
Re: @rInvasгo ao DP - by @Riichard - 01.09.2012, 01:37
Re: @rInvasгo ao DP - by DYTO*17 - 01.09.2012, 01:40
Re: @rInvasгo ao DP - by Q.I - 01.09.2012, 01:42

Forum Jump:


Users browsing this thread: 1 Guest(s)