Multiple connections from same IP
#1

How to block multiple connections from same IP? If that is possible, how can I make it?
Reply
#2

Try this under OPlayerConnect.

pawn Code:
for (new i = 0; i != MAX_PLAYERS; ++i)
    {
        new connectingip[16], oldip[16];
        GetPlayerIp(i, oldip, sizeof(oldip));
        GetPlayerIp(playerid, connectingip, sizeof(connectingip));
        if(connectingip[i] == oldip[playerid])
        {
            Kick(playerid);
        }
    }
Reply
#3

why would you do that? When I go to my friend and we play both sa-mp we have the same IP, there is nothing wrong with two players that have the same IP..
Reply
#4

Something like...

pawn Code:
new
    ConnectedIP[MAX_PLAYERS][16];
   
public OnPlayerConnect(playerid)
{
    new
        p_IP[16],
        g_IP[16]
    ;
       
    GetPlayerIp(playerid, ConnectedIP[playerid], 16);
   
    for ( new u; u < MAX_PLAYERS; u++ )
    {
        GetPlayerIp(u, g_IP, sizeof(g_IP));
        if(g_IP[u] == p_IP[playerid])
        {
            //Multiple IPS! - Do something!
        }
    }
    return 1;
}
This is untested, and it compiles, but I'm not sure it'll work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)