SA-MP Forums Archive
[Ajuda] Anti Flood de comandos - 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] Anti Flood de comandos (/showthread.php?tid=407679)



Anti Flood de comandos - [CGU]iSlin_Shady - 14.01.2013

Queria um Anti - Flood de comandos, que tipo, o cara usa repetidamente um comando, ele recebe um aviso tipo assim " | ANTI - FLOOD | Pare de floodar ou serб bloqueado de usar comandos por 30 segundos.


Re: Anti Flood de comandos - Wellington1999 - 14.01.2013

hihihihiih
Topo

pawn Код:
new TempoComando[MAX_PLAYERS];
No Comando ----
pawn Код:
if(GetTickCount() - Tempocomando[playerid] < 10000)//10000 tempo em segundos hihiih 10 seg adapte qntos tu  quer 30 coloque 30000
            {
                 SendClientMessage(playerid,COR_HITMAN,"Voce tem que esperar um pouco para Digitar Os Comandos!");
                 return 1;
            }
se ajudei + rep


Re: Anti Flood de comandos - [CGU]iSlin_Shady - 14.01.2013

faz em fs pra mim ?


Re: Anti Flood de comandos - [CGU]iSlin_Shady - 14.01.2013

Код:
C:\Users\JUNIOR\Desktop\server\BCR\gamemodes\BCR.pwn(4310) : error 017: undefined symbol "Tempocomando"
C:\Users\JUNIOR\Desktop\server\BCR\gamemodes\BCR.pwn(4310) : warning 215: expression has no effect
C:\Users\JUNIOR\Desktop\server\BCR\gamemodes\BCR.pwn(4310) : error 001: expected token: ";", but found "]"
C:\Users\JUNIOR\Desktop\server\BCR\gamemodes\BCR.pwn(4310) : error 029: invalid expression, assumed zero
C:\Users\JUNIOR\Desktop\server\BCR\gamemodes\BCR.pwn(4310) : fatal error 107: too many error messages on one line



Re: Anti Flood de comandos - Supera - 14.01.2013

Vocк usa a include ZCMD ou a public OnPlayerCommandText?


Re: Anti Flood de comandos - [CGU]iSlin_Shady - 14.01.2013

public OnPlayerCommandText


Respuesta: Anti Flood de comandos - Wellington1999 - 14.01.2013

Mande as linhas

bom vo mandar um comando com esse tipo de funзгo hihihih

Adapte Mais Ou Menos Assim

pawn Код:
if(strcmp(cmd, "/relatorio", true) == 0 || strcmp(cmd, "/relato", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "Vocк nгo estб logado!");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /relatorio [texto]");
                return 1;
            }
            if(TentouDivulgar(result))
            {
                if(cdivulgar[playerid] >= 6)
                {
                    SendClientMessage(playerid, COLOR_LIGHTBLUE,"Aqui vocк nгo pode anunciar servidores!");
                    SendClientMessage(playerid, COLOR_LIGHTBLUE,"Cuidado, Poderб ser banido.");
                    SendClientMessage(playerid, COLOR_LIGHTBLUE,"Evite digitar muitos nъmeros consecutivos.");
                    PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
                    Kick(playerid);
                }
                GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
                format(string, 128, "AdmAviso: [%d]%s tentou divulgar: %s.",playerid,playername,result);
                ABroadCast(COLOR_YELLOW,string,1);
                DivulgouLog(string);
                cdivulgar[playerid] += 1;
                return 1;
            }
            if(GetTickCount() - TempoComando[playerid] < 10000)
            {
                 SendClientMessage(playerid,COR_HITMAN,"Voce tem que esperar um pouco para enviar outro Relatorio!");
                 return 1;
            }
            if(PlayerInfo[playerid][pJailed] != 0)
            {
                SendClientMessage(playerid,0x9E50FFAA," Vocк nгo pode usar esse comando na cadeia!");
                return 1;
            }
            if(PlayerInfo[playerid][pVIP] == 1)
            {
                new lol;
                lol = PlayerInfo[playerid][pVIP];
                format(string, sizeof(string), "{9C9C9C}==> Relatуrio Vip-Prata de %s - ID[%d]: %s <==", sendername, playerid, lol, (result));
                ABroadCast(COR_PRATA,string,1);
                SendClientMessage(playerid, COLOR_YELLOW, "Seu relatуrio VIP foi enviado aos admins, aguarde uma resposta...");
                TempoComando[playerid] = GetTickCount();
            }
            else if(PlayerInfo[playerid][pVIP] == 2)
            {
                new lol;
                lol = PlayerInfo[playerid][pVIP];
                format(string, sizeof(string), "{FFC125}==> Relatуrio Vip-Ouro de %s - ID[%d]: %s <==", sendername, playerid, lol, (result));
                ABroadCast(COR_OURO,string,1);
                SendClientMessage(playerid, COLOR_YELLOW, "Seu relatуrio VIP foi enviado aos admins, aguarde uma resposta...");
                TempoComando[playerid] = GetTickCount();
            }
            else if(PlayerInfo[playerid][pVIP] == 3)
            {
                new lol;
                lol = PlayerInfo[playerid][pVIP];
                format(string, sizeof(string), "{00FFFF}==> Relatуrio Socio de %s - ID[%d]: %s <==", sendername, playerid, lol, (result));
                ABroadCast(0xFFFF50AA,string,1);
                SendClientMessage(playerid, COLOR_YELLOW, "Seu relatуrio VIP Socio foi enviado aos admins, aguarde uma resposta...");
                TempoComando[playerid] = GetTickCount();
            }
            {
                format(string, sizeof(string), "{FFD700}==> Relatуrio de %s(%d): %s <==", sendername, playerid, (result));
                ABroadCast(COR_VAGOS,string,1);
                SendClientMessage(playerid, COLOR_YELLOW, "Seu relatуrio foi enviado aos admins, aguarde uma resposta...");
                Temporelato[playerid] = GetTickCount();
            }
        }
        return 1;
    }
Assim Como й no /relato os relatos vips adiciona igual ta ai blz??


Re: Anti Flood de comandos - [CGU]iSlin_Shady - 14.01.2013

e nem tem como para pegar todos os comandos do servidor, menos de admins ?


Re: Anti Flood de comandos - .FuneraL. - 14.01.2013

Quote:
Originally Posted by [CGU]iSlin_Shady
Посмотреть сообщение
e nem tem como para pegar todos os comandos do servidor, menos de admins ?
Creio eu que isso nгo seja possнvel.


Re: Anti Flood de comandos - HardWar - 14.01.2013

Quote:
Originally Posted by Wellington1999
Посмотреть сообщение
hihihihiih
Topo

pawn Код:
new TempoComando[MAX_PLAYERS];
No Comando ----
pawn Код:
if(GetTickCount() - Tempocomando[playerid] < 10000)//10000 tempo em segundos hihiih 10 seg adapte qntos tu  quer 30 coloque 30000
            {
                 SendClientMessage(playerid,COR_HITMAN,"Voce tem que esperar um pouco para Digitar Os Comandos!");
                 return 1;
            }
se ajudei + rep
Dara erros pois vocк criou a variбvel TempoComando e verificou ali usando Tempocomando