SA-MP Forums Archive
[Ajuda] Ataque Chat-Flood. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Ataque Chat-Flood. (/showthread.php?tid=357652)



Ataque Chat-Flood. - Mercurio - 07.07.2012

Meu servidor vem apresentando fortes ataques de programas, oque me chamou atenзгo foi um que reparei que o player conseguia digitar dezenas de textos em 1 segundo...
Alguйm poderia me ajudar a prevenir esse tipo de ataques?

Uma demostraзгo que peguei no meu server_log;


pawn Код:
[19:37:35] [chat] [Joice_Amaurin]: 7777777
[19:37:35] [chat] [Joice_Amaurin]: 666666
[19:37:35] [chat] [Joice_Amaurin]: 55555
[19:37:36] [chat] [Joice_Amaurin]: 4444
[19:37:36] [chat] [Joice_Amaurin]: 333
[19:37:36] [chat] [Joice_Amaurin]: 22
[19:37:36] [chat] [Joice_Amaurin]: 1
[19:37:36] [chat] [Joice_Amaurin]: 1
[19:37:36] [chat] [Joice_Amaurin]: 22
[19:37:36] [chat] [Joice_Amaurin]: 333
[19:37:36] [chat] [Joice_Amaurin]: 4444
[19:37:36] [chat] [Joice_Amaurin]: 55555
[19:37:36] [chat] [Joice_Amaurin]: 666666
[19:37:36] [chat] [Joice_Amaurin]: 7777777
[19:37:36] [chat] [Joice_Amaurin]: 88888888
[19:37:36] [chat] [Joice_Amaurin]: 999999999
[19:37:36] [chat] [Joice_Amaurin]: 101010101010
[19:37:37] [chat] [Joice_Amaurin]: 999999999
[19:37:37] [chat] [Joice_Amaurin]: 88888888
[19:37:37] [chat] [Joice_Amaurin]: 7777777
[19:37:37] [chat] [Joice_Amaurin]: 666666
[19:37:37] [chat] [Joice_Amaurin]: 55555
[19:37:37] [chat] [Joice_Amaurin]: 4444
[19:37:37] [chat] [Joice_Amaurin]: 333
[19:37:37] [chat] [Joice_Amaurin]: 22
[19:37:37] [chat] [Joice_Amaurin]: 1
[19:37:37] [chat] [Joice_Amaurin]: 1
[19:37:37] [chat] [Joice_Amaurin]: 22
[19:37:37] [chat] [Joice_Amaurin]: 333
[19:37:37] [chat] [Joice_Amaurin]: 4444
[19:37:37] [chat] [Joice_Amaurin]: 55555
[19:37:37] [chat] [Joice_Amaurin]: 666666
[19:37:38] [chat] [Joice_Amaurin]: 7777777
[19:37:38] [chat] [Joice_Amaurin]: 88888888
[19:37:38] [chat] [Joice_Amaurin]: 999999999
[19:37:38] [chat] [Joice_Amaurin]: 101010101010
[19:37:38] [chat] [Joice_Amaurin]: 999999999
[19:37:38] [chat] [Joice_Amaurin]: 88888888
[19:37:38] [chat] [Joice_Amaurin]: 7777777
[19:37:38] [chat] [Joice_Amaurin]: 666666
[19:37:38] [chat] [Joice_Amaurin]: 55555
Sou grato desde jб.


Re: Ataque Chat-Flood. - @Riichard - 07.07.2012

Usa, um anti-flooda de chat, e vejб oque aconteзe.
Teste vocк mesmo. Existe muitos programas de flooder no chat por ai..


Re: Ataque Chat-Flood. - GReeN_WOoD - 08.07.2012

OnPlayerConnect, tente por isso, pode ajudar atй conseguirmos achar uma soluзгo para este LAG.

PHP код:
    if (strfind(text"101010101010"true) != -1)
    {
        new 
lag[64];
        new 
FDP[MAX_PLAYER_NAME];
        
GetPlayerName(playeridFDPsizeof(FDP));
        
format(lagsizeof(lag), "[ANT-LAG] %s foi kickado por tentar lagar o servidor"FDP);
        
SendClientMessageToAll(-1lag);
        
Kick(playerid);
        return 
false;
    } 



Re: Ataque Chat-Flood. - Ricop522 - 08.07.2012

pawn Код:
new chatTimer[MAX_PLAYERS];


// OnPlayerText
if(chatTimer[playerid] < gettime()) return SendClientMessage(playerid, -1, "Aguarde 3 segundos.");

chatTimer[playerid] = gettime()+3;



Re: Ataque Chat-Flood. - Jason` - 08.07.2012

Usa esse fs, testado e funcional:

pawn Код:
// Copyright © 2012 iPs TeaM
// Intelligent Programming Style
// Created by [iPs]Pedro or Pedro Miranda

#include <a_samp>

new Flood[MAX_PLAYERS],
    Floods[MAX_PLAYERS];

public OnPlayerText(playerid, text[])
{
    if(gettime() >= Flood[playerid] && Flood[playerid] > 0)
    {
        Flood[playerid] = 0;
        Floods[playerid] = 0;
    }
    else
    {
        ++Floods[playerid];
        if(Floods[playerid] == 3)
        {
            new string[90];
            new name[24];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "%s foi kickado por flood.", name);
            SendClientMessageToAll(-1, string);
            Kick(playerid);
        }
    }
    Flood[playerid] = gettime() + 3; // Troque 3 pelo intervalo em segundos que o jogador deve aguardar para enviar mensagens.
    return 1;
}



Re: Ataque Chat-Flood. - zSuYaNw - 08.07.2012

Usa esta funзгo no final do GameMode:
pawn Код:
new Flooding[MAX_PLAYERS char];
stock IsPlayerFlooding(pid, maxtime)
{
        if(tickcount() - Flooding{pid} < maxtime)
            return Flooding{pid} = tickcount(), true;
    return Flooding{pid} = tickcount(), false;
}

No OnPlayerText:
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerFlooding(playerid, 3000))
    {
        if(Spam[playerid] == 3)
        {
            new str[120], nome[24]; GetPlayerName(playerid, nome, 24);
            format(str, sizeof(str), "%s foi kikado por flood", nome);
        }
        Spam[playerid] ++;
    }
    return false;
}