Getting auto banned when logging[will rep]
#1

Hello so i fixed my ban system then i realised that i did if a player connects while he is not banned he gets auto banned any ways like i didnt use the command to ban myself and it kicks me automaticly from the game without saying anything and i removed that code that kicks a banned player and it was fixed but i still want banned players to get kicked if they try to log in
the code is in player connect
here is my code

pawn Код:
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;
        }
    }
and i use zcmd
Reply
#2

Change.
Код:
Kick(playerid);
To.
Код:
SetTimerEx("KickPlayer",1000,0,"i",playerid);
And put this callback to your filterscript or gamemode.
Код:
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
	Kick(playerid);
	return 1;
}
Reply
#3

i am still getting auto kicked even if i didnt use tempban on myself the code i gave is making me get kicked when i didnt even do the command on myself yet any ideas?
Reply
#4

Show us more code, OnPlayerConnect.
Reply
#5

Here
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]))
        {   // ban type is name
            SendClientMessage(playerid,COLOR_RED,"Your ban has not expired!");
            SetTimerEx("KickPlayer",1000,0,"i",playerid);
            return 1;
        }
       
        if(!strcmp(ip,TempBans[id][BannedIP]))
        {   // ban type is ip !
            SendClientMessage(playerid,COLOR_RED,"Your ban has not expired!");
            SetTimerEx("KickPlayer",1000,0,"i",playerid);
            return 1;
        }
    }
    return 1;
}
Reply
#6

If string is null is same, so add this.
Код:
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(strlen(TempBans[id][BannedName]) > 0 && !strcmp(name,TempBans[id][BannedName]))
        {   // ban type is name
            SendClientMessage(playerid,COLOR_RED,"Your ban has not expired!");
            SetTimerEx("KickPlayer",1000,0,"i",playerid);
            return 1;
        }

        if(strlen(TempBans[id][BannedIP]) > 0 && !strcmp(ip,TempBans[id][BannedIP]))
        {   // ban type is ip !
            SendClientMessage(playerid,COLOR_RED,"Your ban has not expired!");
            SetTimerEx("KickPlayer",1000,0,"i",playerid);
            return 1;
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)