[Ajuda] /tempban bugado ajuda arruma
#1

Quando eu do /tempban ele bane mais quando alguem tenta entrar no server ele da kick por causa do sistema

Se puderen me ajudar desde ja agradeзo e muito
Erro=//bug no tempbancheck desde kickar o player banido ele kickaqualquer 1
COMANDO
PHP код:
    if(strcmp(cmd"/tempban"true) == 0)
    {
        if (
PlayerInfo[playerid][pAdmin] >= 4)
        {
            
tmp strtok(cmdtext,idx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridORANGE"USAGE: /tempban [playerid] [day] [reason]");
                
SendClientMessage(playeridORANGE"FUNЗГO: Proibiзгo tenporaria.");
                return 
1;
            }
            
giveplayerid ReturnUser(tmp);
            new 
string[128];
            if(
IsPlayerConnected(giveplayerid))
            {
                
tmp strtok(cmdtextidx);
                if (!
strlen(tmp)) return SendClientMessage(playeridORANGE"USAGE: /tempban [playerid] [day] [reason]");
                new 
days strval(tmp);
                new 
reason[128];
                
reason bigstr(cmdtextidx);
                if (!
strlen(reason)) return SendClientMessage(playeridORANGE"USAGE: /tempban [playerid] [day] [REASON]");
                new 
ip[15];
                new 
name[MAX_PLAYER_NAME];
                
GetPlayerIp(giveplayerid,ip,15);
                
GetPlayerName(playeridnamesizeof name);
                
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                new 
File:tempban fopen("TempBans.txt"io_append);
                if (
tempban)
                {
                    new 
year,month,day;
                    
getdate(yearmonthday);
                    
day += days;
                    if (
IsMonth31(month))
                    {
                        if (
day 31)
                        {
                            
month += 1;
                            if (
month 12)
                            {
                                
year += 1;
                                while(
day 31day -= 31;
                            }
                            else while(
day 31day -= 31;
                        }
                    }
                    else if (!
IsMonth31(month))
                    {
                        if (
day 30)
                        {
                            
month += 1;
                            if (
month 12)
                            {
                                
year += 1;
                                while(
day 30day -= 30;
                            }
                            else while(
day 30day -= 30;
                        }
                    }
                    else if (!
IsMonth31(month) && IsMonth29(year) && month == 2)
                    {
                        if (
day 29)
                        {
                            
month += 1;
                            if (
month 12)
                            {
                                
year += 1;
                                while(
day 29day -= 29;
                            }
                            else while(
day 29day -= 29;
                        }
                    }
                    else if (!
IsMonth31(month) && !IsMonth29(year) && month == 2)
                    {
                        if (
day 28)
                        {
                            
month += 1;
                            if (
month 12)
                            {
                                
year += 1;
                                while(
day 28day -= 28;
                            }
                            else while(
day 28day -= 28;
                        }
                    }
                    
format(stringsizeof string"%d|%d|%d|%s\n"daymonthyearip);
                    
fwrite(tempbanstring);
                    
fclose(tempban);
                }
                
format(string,128,"|- Administrador %s proibiu temporariamente %s Para %d dia(s). [Motivo: %s] -|",name,giveplayer,days,reason);
                
SendClientMessageToAll(ADMIN_RED,string);
                
Kick(giveplayerid);
            }
            else
            {
                
format(stringsizeof(string), "%d nгo й um jogador ativo."giveplayerid);
                
SendClientMessage(playeridREDstring);
            }
        }
        else return 
SendClientMessage(playeridRED"Voce nao й um administrador.");
        return 
true;
    } 
CHECA TEMPBAN QUE O PLAYER ESTA
PHP код:
public OnPlayerConnect(playerid)
{
    
TempBanCheck(playerid); 
QUANDO ELE CHECA ELE DA KICK PODE SER QUALQUER UM SEM ESTAR BANIDO
POR CAUSA DESTI BUG NO TempBanCheck
JA TIREI O Kick(playerid) da certo mais o cara banido consegue entrar por causa disso ai
PHP код:
stock TempBanCheck(playerid)
{
    new 
ip[15];
    new 
str[128];
    new 
load[4][32];
    new 
ban_dayban_monthban_yearban_ip[15];
    
GetPlayerIp(playeridipsizeof ip);
    new 
yearmonthday;
    
getdate(yearmonthday);
    new 
File:file fopen("TempBans.txt",io_read);
    if (
file)
    {
        while (
fread(filestrsizeof str))
        {
            
split(strload'|');
            
ban_day strval(load[0]);
            
ban_month strval(load[1]);
            
ban_year strval(load[2]);
            
strmid(ban_ipload[3], 0strlen(load[3])-115);
            if (!(
year >= ban_year && month >= ban_month && day >= ban_day && !strcmp(ban_ipiptrue)))
            {
                
format(strsizeof str"|- Vocк estб temporariamente banido do servidor atй: %d/%d/%d -|"ban_dayban_monthban_year);
                
SendClientMessage(playeridADMIN_REDstr);
                return 
Kick(playerid);
            }
        }
    }
    return 
true;

PHP код:
 
Reply
#2

espero que alguem me ajude
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)