SA-MP Forums Archive
YOUR BAN HAS NOT EXPIRED, help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: YOUR BAN HAS NOT EXPIRED, help. (/showthread.php?tid=194322)



YOUR BAN HAS NOT EXPIRED, help. - Darklom - 29.11.2010

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;
}



Re: YOUR BAN HAS NOT EXPIRED, help. - Leeroy. - 29.11.2010

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


Re: YOUR BAN HAS NOT EXPIRED, help. - Darklom - 29.11.2010

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


Re: YOUR BAN HAS NOT EXPIRED, help. - JaTochNietDan - 29.11.2010

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.


Re: YOUR BAN HAS NOT EXPIRED, help. - Darklom - 29.11.2010

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?