YOUR BAN HAS NOT EXPIRED, help.
#1

I am using "cjbantemp" and it continues to say "Your ban has not expired!" what seems to be the issue here?

Код:
public OnPlayerConnect(playerid)
{
	new name[24],ip[16];
	GetPlayerIp(playerid,ip,sizeof ip);
	GetPlayerName(playerid,name,sizeof name);
    for(new id; id < 24; id++)
	{
		if(!strcmp(name,TempBans[id][BannedName]))
		{   // ban type is name
		    SendClientMessage(playerid,COLOR_RED,"Your ban has not expired!");
		    Kick(playerid);
		    return 1;
		}
		
		if(!strcmp(ip,TempBans[id][BannedIP]))
		{   // ban type is ip !
		    SendClientMessage(playerid,COLOR_RED,"Your ban has not expired!");
		    Kick(playerid);
		    return 1;
		}
	}
	return 1;
}
Reply
#2

post it on cjbantemp topic you could get some help there.
Reply
#3

I would but it seems the thread maker doesn't keep up with it, I am now asking for the help of the community.
Reply
#4

If either of the strings in the strcmp are empty, then it'll return 0, and the if statement will be true, therefore it'll say the ban has not expired, and in fact looking at your code, this seems like it will always happen unless all temporary ban slots are filled.

I recommend giving this a try:

pawn Код:
public OnPlayerConnect(playerid)
{
    new name[24],ip[16];
    GetPlayerIp(playerid,ip,sizeof ip);
    GetPlayerName(playerid,name,sizeof name);
    for(new id; id < 24; id++)
    {
        if(!strcmp(name,TempBans[id][BannedName]) && strlen(TempBans[id][BannedName]) != 0)
        {   // ban type is name
            SendClientMessage(playerid,COLOR_RED,"Your ban has not expired!");
            Kick(playerid);
            return 1;
        }
       
        if(!strcmp(ip,TempBans[id][BannedIP]) && strlen(TempBans[id][BannedName]) != 0)
        {   // ban type is ip !
            SendClientMessage(playerid,COLOR_RED,"Your ban has not expired!");
            Kick(playerid);
            return 1;
        }
    }
    return 1;
}
Although I'm not sure how this ban system you're using works, I'm pretty sure your issue is with the string being empty in strcmp. So this code should fix that problem.
Reply
#5

This is a filterscript, I'm not exactly sure on how to add a /accept report
/reports to check reports
and /deny report
Any help?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)