[AJUDA]Apenas Permitir 2 ips iguais no servidor
#8

Nгo testei meu cуdigo, mas teste-o.

pawn Код:
#include <a_samp>
   
CountPlayersWithIP(ip[])
{
    new
        count,
        player_ip[16];
    for(new i; i != GetMaxPlayers(); ++i)
    {
        if(IsPlayerConnected(i))
        {
            GetPlayerIp(i, player_ip, sizeof player_ip);
            count += (!strcmp(player_ip, ip, true)) ? 1 : 0;
        }
    }
    return count;
}

public OnPlayerConnect(playerid)
{
    new
        count_ip,
        player_ip[16];
       
    GetPlayerIp(playerid, player_ip, sizeof player_ip);
    count_ip = CountPlayersWithIP(player_ip);
    if(count_ip > 2)
    {
        return Ban(playerid);
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)