SA-MP Forums Archive
Getting auto banned when logging[will rep] - 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)
+--- Thread: Getting auto banned when logging[will rep] (/showthread.php?tid=490240)



Getting auto banned when logging[will rep] - DarkLored - 25.01.2014

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


Re: Getting auto banned when logging[will rep] - Ranshand - 25.01.2014

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



Re: Getting auto banned when logging[will rep] - DarkLored - 25.01.2014

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?


Re: Getting auto banned when logging[will rep] - Ranshand - 25.01.2014

Show us more code, OnPlayerConnect.


Re: Getting auto banned when logging[will rep] - DarkLored - 25.01.2014

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



Re: Getting auto banned when logging[will rep] - Ranshand - 25.01.2014

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