SA-MP Forums Archive
[Pedido] A-F - 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: [Pedido] A-F (/showthread.php?tid=393612)



A-F - s4kuL - 18.11.2012

Queria que alguem me desse uma base de ant flood, tipo so queria impedir jogadores de enviar mensagem no chat em menos de 2 segundos, ai cada ves que ele fazer ganha uma adivertencia pflood[playerid] = ++; ... ai com 5 ele й mudo, mais a funзгo do mudo eu faзo ..


Re: A-F - VenoN - 18.11.2012

nossa n sabe usar settimer?


Re: A-F - Sky™ - 18.11.2012

pawn Код:
#include <a_samp>

new IsFlooding[MAX_PLAYERS];
new Flooder[MAX_PLAYERS];
new szPlayerChatMsg[MAX_PLAYERS][128];

public OnGameModeInit()
{
    print("\n--------------------------------------");
    print(" FilterScript Ant-Flood BY: [LF]PlaYer");
    print("--------------------------------------\n");
    return 1;
}


public OnPlayerText(playerid, text[])
{
    if(Flooder[playerid] == 1)
    {
        SendClientMessage(playerid, -1, "{FF0000}[ERRO]{FFFFFF} Vocк estб calado e nгo pode usar o chat !");
        return 0;
    }
    IsFlooding[playerid]++;
    if(!IsPlayerAdmin(playerid))
    {
        if(strlen(text) == strlen(szPlayerChatMsg[playerid]) && !strcmp(szPlayerChatMsg[playerid], text,  false))
        {
            SendClientMessage(playerid, -1, "{FF0000}[ERRO]{FFFFFF} Nгo repita a mesma mensagem!");
            format(szPlayerChatMsg[playerid], 128, "%s", text);
            return 0;
        }
    }
    if(IsFlooding[playerid] >= 3)
    {
        IsFlooding[playerid] = 0;
        Flooder[playerid] = 1;
        SendClientMessage(playerid, -1, "{FF0000}[INFO]{FFFFFF} Vocк foi calado por 1 minuto. Motivo: Flood !");
        SetTimerEx("LiberarChat", 60000, false, "i", playerid);
        return 0;
    }
    else
    {
        SetTimerEx("SemFlood", 2000, false, "i", playerid);
    }
    return 1;
}

forward SemFlood(playerid);
public SemFlood(playerid)
{
    IsFlooding[playerid] = 0;
    return 1;
}

forward LiberarChat(playerid);
public LiberarChat(playerid)
{
    Flooder[playerid] = 0;
    SendClientMessage(playerid, -1, "Vocк foi descalado, nгo faзa mais flood !");
    return 1;
}
/* Nгo retire os creditos Criador: [LF]PlaYer  
Com Ajuda de rjjj */



Re: A-F - s4kuL - 18.11.2012

Nгo quero o do dPlaYer..


Re: A-F - Sky™ - 18.11.2012

cara mais folgado que vc sу ele




Re: A-F - s4kuL - 19.11.2012

poisй nй


Re: A-F - Lucas-Fc - 19.11.2012

Quote:
Originally Posted by s4kuL
Посмотреть сообщение
poisй nй
Vou te ajudar por que vocк jб me ajudou a algum tempo a traz.

pawn Код:
public OnPlayerText(playerid, text[]) {

    if(gettime() < GetPVarInt(playerid, #flood))
        return SendClientMessage(playerid, -1, "Aguarde para enviar outra mensagem.");

    SetPVarInt(playerid, #flood, (gettime() + 3));
    return 1;
}