Ban command is bugged
#1

When I ban someone, he can still join the server and login.

Where is the problem?

PHP код:
CMD:ban(playeridparams[])
{
    
LevelCheck(playerid1);
    new 
targetreason[35], days;
    if(
sscanf(params"is[35]I(0)"targetreasondays)) return Usage(playerid"ban [playerid] [reason] [days(0 for permanent ban)]");
    if(!
IsPlayerConnected(target)) return Error(playerid"The specified player is not connected, use /oban instead.");
    if(
target == playerid) return Error(playerid"You cannot ban yourself.");
    if(
GetLevel(playerid) < GetLevel(target)) return Error(playerid"You cannot use this command on higher level admin.");
    if(
days 0) return Error(playerid"Invalid days, must be greater than 0 for temp ban, or 0 for permanent ban.");
    if(
strlen(reason) < || strlen(reason) > 35) return Error(playerid"Invalid reason length, must be b/w 0-35 characters.");
    new 
bandate[18], date[3], time;
    
getdate(date[0], date[1], date[2]);
    
format(bandatesizeof(bandate), "%02i/%02i/%i"date[2], date[1], date[0]);
    if(
days == 0time 0;
    else 
time = ((days 24 60 60) + gettime());
    new 
handle SQL::Open(SQL::INSERT""BANS_TABLE"");
    
SQL::ToggleAutoIncrement(handletrue);
    
SQL::WriteString(handle"ban_username"GetName(target));
    
SQL::WriteString(handle"ban_ip"GetIP(target));
    
SQL::WriteString(handle"ban_by"GetName(playerid));
    
SQL::WriteString(handle"ban_on"bandate);
    
SQL::WriteString(handle"ban_reason"reason);
    
SQL::WriteInt(handle"ban_expire"time);
    
SQL::Close(handle);
    if(
days == 0)
    {
        new 
string[144];
        
format(stringsizeof(string), "* %s(%i) has been banned by Admin %s(%d) "orange"[Reason: %s]"GetName(target), targetGetName(playerid), playeridreason);
        
SendClientMessage(targetCOLOR_REDstring);
        
#if defined SAVE_LOGS
            
SaveLog("bans.txt"string);
        
#endif
    
}
    else
    {
        new 
string[258];
        
format(stringsizeof(string), "* %s(%i) has been temp banned by Admin %s(%d) "orange"[Reason: %s] [Days: %i]"GetName(target), targetGetName(playerid), playeridreasondays);
        
SendClientMessage(targetCOLOR_REDstring);
        
#if defined SAVE_LOGS
            
SaveLog("bans.txt"string);
        
#endif
        
format(stringsizeof(string), "* Temp banned for %i days "orange"[Unban on %s]"daysConvertTime(time));
        
SendClientMessage(targetCOLOR_REDstring);
    }
     
PlayerPlaySound(target10570.00.00.0);
    
PlayerPlaySound(playerid10570.00.00.0);
    
DelayKick(target);
    return 
1;

Reply


Messages In This Thread
Ban command is bugged - by Fantje - 03.08.2016, 12:09
Re: Ban command is bugged - by oMa37 - 03.08.2016, 12:15
Re: Ban command is bugged - by Fantje - 03.08.2016, 12:17
Re: Ban command is bugged - by oMa37 - 03.08.2016, 12:18
Re: Ban command is bugged - by Fantje - 03.08.2016, 12:19
Re: Ban command is bugged - by oMa37 - 03.08.2016, 12:24
Re: Ban command is bugged - by Sew_Sumi - 03.08.2016, 12:24
Re: Ban command is bugged - by Fantje - 03.08.2016, 12:34
Re: Ban command is bugged - by Fantje - 03.08.2016, 12:37
Re: Ban command is bugged - by BoBiTza - 03.08.2016, 13:44

Forum Jump:


Users browsing this thread: 1 Guest(s)