Working anti-reconnect.
#10

Quote:
Originally Posted by Scottas
Посмотреть сообщение
pawn Код:
#include    <a_samp>

#define     MIN_RECONNECT_TIME      5000

new
    gIP[MAX_PLAYERS][16],
    gTime[MAX_PLAYERS];

public  OnPlayerDisconnect(playerid, reason)
{
    GetPlayerIp(playerid, gIP[playerid], 16);
    gTime[playerid] = GetTickCount();
}

public  OnPlayerConnect(playerid)
{
    new
        IP[16],
        Time = GetTickCount();
       
    //  first check if playerid hasn't changed
    GetPlayerIp(playerid, IP, 16);
    if(!strcmp(IP, gIP[playerid]))
    {
        //  Check time passed
        if(Time - gTime[playerid] < MIN_RECONNECT_TIME)
            Kick(playerid);
        return 1;
    }
    //  else we're going to check all the players
    for(new i; i < MAX_PLAYERS; i++)
    {
        if((i == playerid) || IsPlayerConnected(i))
            continue;
        //  We make sure, that gIP[i] is not empty
        if(strlen(gIP[i]) && gTime[i] != 0)
        {
            if(!strcmp(IP, gIP[i])) // IP match
            {
                if(Time - gTime[i] < MIN_RECONNECT_TIME)    // time have not passed
                {
                    Kick(playerid);
                    break;
                }
            }
        }
    }
    return 1;
}
Try this. I have not tested it yet, I don;t have any of these hacks. It should work as filterscript
Tested it, when I go ingame, it just wont connect to the server.
Reply


Messages In This Thread
Working anti-reconnect. - by tuuler - 17.07.2014, 17:29
Re: Working anti-reconnect. - by GeekSiMo - 17.07.2014, 17:30
Re: Working anti-reconnect. - by tuuler - 17.07.2014, 17:33
Re: Working anti-reconnect. - by GeekSiMo - 17.07.2014, 17:37
Re: Working anti-reconnect. - by tuuler - 17.07.2014, 17:38
Re: Working anti-reconnect. - by Scottas - 17.07.2014, 17:42
Re: Working anti-reconnect. - by tuuler - 17.07.2014, 17:44
Re: Working anti-reconnect. - by Kyance - 17.07.2014, 17:58
Re: Working anti-reconnect. - by Scottas - 17.07.2014, 18:04
Re: Working anti-reconnect. - by tuuler - 17.07.2014, 18:28

Forum Jump:


Users browsing this thread: 1 Guest(s)