[Pedido] Um anti Flood Comands.
#10

tenta
pawn Код:
//No Topo do GM:

new Comandos[MAX_PLAYERS][20];
new FloodComandos[MAX_PLAYERS];


//No comeзo do OnPlayerCommandText:

new ComandoAtual[20];
    new Parametro;
    ComandoAtual = strtok(cmdtext, Parametro);
    if(!strcmp(ComandoAtual, Comandos[playerid], true) && strlen(Comandos[playerid]))
    {
        FloodComandos[playerid]++;
        SendClientMessage(playerid, 0x33CCFFAA, "Proibido flood em comandos !");
        if(FloodComandos[playerid] == 3)
        {
            Comandos[playerid] = ("");
            FloodComandos[playerid] = 0;
            new STR[65];
            new NickName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, NickName, MAX_PLAYER_NAME);
            format(STR, 65, "%s Foi kickado por floodar nos comandos!", NickName);
            SendClientMessageToAll(0xFF0000AA, STR);
            Kick(playerid);
        }
        return 1;
    }
    else
    {
        FloodComandos[playerid] = 0;
    }
    format(Comandos[playerid], 20, "%s", ComandoAtual);



//E, se a funзгo strtok nгo estiver declarada, no Final do GM:

stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
procurei e achei isso ae tenta deve funciona

creditos a Rjjj
Reply


Messages In This Thread
Um anti Flood Comands. - by Mercurio - 22.07.2012, 03:33
Re: Um anti Flood Comands. - by Mercurio - 22.07.2012, 03:39
AW: Um anti Flood Comands. - by billy the kid - 22.07.2012, 03:43
Re: Um anti Flood Comands. - by Arthenry - 22.07.2012, 03:48
AW: Um anti Flood Comands. - by billy the kid - 22.07.2012, 03:50
Re: Um anti Flood Comands. - by Abravanel - 22.07.2012, 03:55
Re: Um anti Flood Comands. - by Mercurio - 22.07.2012, 03:57
AW: Um anti Flood Comands. - by billy the kid - 22.07.2012, 04:00
Re: AW: Um anti Flood Comands. - by Mercurio - 22.07.2012, 04:15
AW: Um anti Flood Comands. - by billy the kid - 22.07.2012, 04:39

Forum Jump:


Users browsing this thread: 1 Guest(s)