[Ajuda] Anti Floods
#1

Eu pesquisei por um tutorial para fazer ANTI FLOODS para textos e comandos, mas nenhum dos dois estгo funcionando;

Eu uso o comando /sethealth 0 100
Se eu uso ele num intervalo de tempo pequeno mostra a mensagem:

Код:
public OnPlayerCommandText(playerid, cmdtext[]) { return 0; }
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if((gettime() - Spamming[playerid]) <= 2 && Spamming[playerid])
    {
        return SendClientMessage(playerid, -1, "[ANTI-FLOOD] COMMAND! Wait a while to use commands again.");
    }
    Spamming[playerid] = gettime();
    return 1;
}
Mas continua executando o comando normalmente...


A mesma coisa pra mensagem no jogo, mostra a mensagem para esperar, mas o texto continua saindo, alguйm sabe como arrumar?
[ANTI-FLOOD] TEXT! Wait a while to talk again.

Код:
public OnPlayerText(playerid, text[]) {
    // anti FLOOD
    if((gettime() - Spamming[playerid]) <= 2 && Spamming[playerid])
    {
        return SendClientMessage(playerid, -1, "[ANTI-FLOOD] TEXT! Wait a while to talk again.");
    }
    Spamming[playerid] = gettime(); 
    // anti AD
	new ver_string[128];
	strmid(ver_string, text, 0, strlen(text));
	if(FindIpPattern(playerid,ver_string)) {
		new string[128];
		format(string,sizeof(string),"AdmCmd: %s was KICKED from the server. Reason: AD.", PlayerName(playerid));
		SendClientMessageToAll(COLOR_LIGHTRED, string);
		Kick(playerid);
		return 0;
	}
	// MSG
	new string[128];
	if(fmembro[playerid] > 0) {
		new facdocara[32];
		strcat(facdocara, FactionInfo[fmembro[playerid]][facname]);
		format(string, sizeof(string), "[%s]%s(ID:%i): %s", facdocara, PlayerName(playerid), playerid, text);
	}
	else {
		format(string, sizeof(string), "%s(ID:%i): %s", PlayerName(playerid), playerid, text);
	}
    ProxDetector(20.0, playerid,string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
	new AnimTime = strlen(text) * 220;
	ApplyAnimation(playerid, "PED", "IDLE_CHAT",4.1,1,1,1,1,1);
	SetTimerEx("LimparAnim", AnimTime, false, "i", playerid);  
    return 0;
}
Reply


Messages In This Thread
Anti Floods - by maikons - 27.12.2017, 01:12
Re: Anti Floods - by RodrigoMSR - 27.12.2017, 01:47
Re: Anti Floods - by maikons - 28.12.2017, 01:19

Forum Jump:


Users browsing this thread: 1 Guest(s)