[Ajuda] Sistema de BAN
#1

Galera,to com um probleminha,eu uso /ban ou /aviso (3x) e as vezes aparece que o player й ban ele й desconectado,mas ele consegue voltar,e ainda com o mesmo nick,tentei arrumar mas nгo consegui,gostaria de saber se um BUG do comando ou do samp.

Comando /ban:

pawn Код:
if(strcmp(cmd, "/ban", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /ban [id] [motivo]");
                return true;
            }
            giveplayerid = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 4)
            {
       if(admtrampando[playerid] < 1 && PlayerInfo[playerid][pAdmin] != DONO)
       if (PlayerInfo[playerid][pHelper] >= 151)
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб trabalhando! (/trabalhar)");
                    return true;
                }
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(PlayerInfo[giveplayerid][pAdmin] >= SUB_DONO)
                        {
                            SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo pode banir um Admin Dono !");
                            return true;
                        }
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        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: /ban [id] [motivo]");
                            return true;
                        }
                        getdate(year, month, day);
                        if(admtrampando[playerid] == 1 && admhide[playerid] == 1)
                        {
                            format(string, sizeof(string), "AdmCmd: %s foi banido por Homem_Aranha(Modo Cia), Motivo: %s (%d-%d-%d)", giveplayer,(result),day,month,year);
                            BanLog(string);
                            format(string, sizeof(string), "AdmCmd: %s foi banido por Homem_Aranha, Motivo: %s", giveplayer,(result));
                            SendClientMessageToAll(COLOR_LIGHTRED, string);
                        }
                        else
                        {
                            format(string, sizeof(string), "AdmCmd: %s foi banido por %s, Motivo: %s (%d-%d-%d)", giveplayer, sendername, (result),day,month,year);
                            BanLog(string);
                            format(string, sizeof(string), "AdmCmd: %s foi banido por %s, Motivo: %s", giveplayer, sendername, (result));
                            SendClientMessageToAll(COLOR_LIGHTRED, string);
                        }
                        SendClientMessage(giveplayerid, COLOR_WHITE, "|________________[ Instruзхes para revisгo de Ban ]________________|");
                        SendClientMessage(giveplayerid, COLOR_YELLOW2, "Tire uma SS da tela apertando F8 imediatamente apуs ser banido");
                        SendClientMessage(giveplayerid, COLOR_YELLOW2, "E acesse o nosso forum: www.{FFCC00}brasilplaystory{FFFFFF}.com.br");
                        SendClientMessage(giveplayerid, COLOR_LIGHTRED, "Atenзгo: Vocк sу serб desbanido caso for inocente");
                        //Ban(giveplayerid);
                        PlayerInfo[giveplayerid][pBan] = 1;
                        SBan(giveplayerid, result, PlayerName(playerid));
                        return true;
                    }
                }//not connected
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   Esse nгo й um jogador ativo.");
            }
        }
        return true;
    }
/Aviso
pawn Код:
if(strcmp(cmd, "/aviso", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /aviso [id] [motivo]");
                return true;
            }
            giveplayerid = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
    if(admtrampando[playerid] < 1 && PlayerInfo[playerid][pAdmin] != DONO)
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб trabalhando! (/trabalhar)");
                    return true;
                }
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        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: /aviso [id] [motivo]");
                            return true;
                        }
                        PlayerInfo[giveplayerid][pWarns] += 1;
                        if(PlayerInfo[giveplayerid][pWarns] >= 3)
                        {
                            getdate(year, month, day);
                            if(admtrampando[playerid] == 1 && admhide[playerid] == 1)
                            {
                                format(string, sizeof(string), "AdmCmd: %s foi banido por Homem_Aranha(Modo Cia), Motivo: %s (%d-%d-%d)", giveplayer, (result),day,month,year);
                                BanLog(string);
                                format(string, sizeof(string), "AdmCmd: %s foi banido por Homem_Aranha (Tinha 3 Avisos), Motivo: %s", giveplayer,(result));
                                SendClientMessageToAll(COLOR_LIGHTRED, string);
                            }
                            else
                            {
                                format(string, sizeof(string), "AdmCmd: %s foi banido por %s, Motivo: %s (%d-%d-%d)", giveplayer, sendername, (result),day,month,year);
                                BanLog(string);
                                format(string, sizeof(string), "AdmCmd: %s foi banido por %s (Tinha 3 Avisos), Motivo: %s", giveplayer, sendername, (result));
                                SendClientMessageToAll(COLOR_LIGHTRED, string);
                            }
                            getdate(Ano, Mes, Dia);
                            PlayerInfo[giveplayerid][pBan] = 1;
                            SBan(giveplayerid, "Terceiro aviso", PlayerName(playerid));
                            return true;
                        }
                        format(string, sizeof(string), "AdmCmd: %s foi avisado por %s, Motivo: %s", giveplayer, sendername, (result));
                        SendClientMessageToAll(COLOR_LIGHTRED, string);
                        return true;
                    }
                }//not connected
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   Esse nгo й um jogador ativo.");
            }
        }
        return true;
    }
Obrigado.
Reply
#2

Cria uma pasta /bans...

Quando alguem for banido, cria uma conta pro player nesta pasta de banidos... Com o IP, Admin q baniu ETC...
E checa se existe esse arquivo de "ban" quando ele se conecta pra kikar ele...

Alguns sistemas nao sгo complicados. As pessoas complicam.
Reply
#3

pawn Код:
if(admtrampando[playerid] < 1 && PlayerInfo[playerid][pAdmin] != DONO)
       if (PlayerInfo[playerid][pHelper] >= 151)
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб trabalhando! (/trabalhar)");
                    return true;
                }
revisa isso ai manolo '-'
Reply
#4

Opa valeu Murilo,arrumei isso jб,e as pastas estгo criadas corretamente,porque tem players que eu do ban apenas 1 vez eles nгo conseguem logar mais,mas tem uns que depois 1,2,3 vezes atй serem ban de verdade,e ele й kikado.
Cara nгo sei se faz sentido,mas tinha um bug do samp que vocк dava alt+tab,ai esperava o adm te prender e vocк resetava o modem sem voltar para o game,quando vocк entrava de novo nгo estava preso,serб que pode ser isso?

Essa parte que cria o arquivo e da kick.
SBan:
pawn Код:
public SBan(playerid, string[], string2[])
{
    new arquivo[64], tmp[20], tmp2[20], stri[64], ip[16];
    GetPlayerIp(playerid, ip, sizeof ip);
    format(arquivo, sizeof(arquivo), "Banidos/%s.ini",PlayerName(playerid));
    getdate(Ano, Mes, Dia);
    format(tmp, 20, "%d/%d/%d", Dia, Mes, Ano);
    gettime(Hora, Minuto, Segundo);
    format(tmp2, 20, "%d:%d:%d", Hora, Minuto, Segundo);
    format(gstring, 128, "[%d/%d/%d] [%d:%d:%d] %s IP:%s foi banido pelo admin %s, motivo: %s", v[2], v[1], v[0], v[3], v[4], v[5], PlayerName(playerid),
    ip, string2, string);
    SBanLog(gstring);
    if(dini_Exists(arquivo))
    {
        Kick(playerid);
    }
    else
    {
        dini_Create(arquivo);
        dini_Set(arquivo,"Motivo",string);
        dini_Set(arquivo,"Admin",string2);
        dini_Set(arquivo,"Data",tmp);
        dini_Set(arquivo,"Hora",tmp2);

        format(stri, sizeof(stri), "IPsBanidos/%s.ini",ip);
        dini_Create(stri);
        dini_Set(stri,"Motivo",string);
        dini_Set(stri,"Admin",string2);
        dini_Set(stri,"Data",tmp);
        dini_Set(stri,"Hora",tmp2);
        dini_Set(stri,"Nick",PlayerName(playerid));
        Kick(playerid);
    }
    return true;
}
Reply
#5

bug do login
fazemos isso qndo estamos banidos
/rcon login senha
/rcon ban id
ele n passa da tela do samp
Reply
#6

Wellington1999,valeu pela dica,mas que bug й esse do login?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)