SA-MP Forums Archive
How to max 3 accounts on 1 IP - 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: How to max 3 accounts on 1 IP (/showthread.php?tid=542284)



How to max 3 accounts on 1 IP - TheNerka - 18.10.2014

How to register system for max 3 accounts on 1 IP? using mysql r38


Re: How to max 3 accounts on 1 IP - AmirRFCNR - 18.10.2014

I Have This Code in my script but MAX 1 Account on 1 ip (anti Multi Acc)

Put it in Your Register Function:
pawn Код:
new pIP[18];
GetPlayerIp(playerid, pIP, sizeof(pIP));

new string[64];
new File:example = fopen("IPS.txt", io_read);
while(fread(example, string))
{
    if(strfind(string, pIP, true) != -1)
    {
        SendClientMessage(playerid, -1, "you can only register with 1 account on 1 IP");
        Kick(playerid);//will kick the player if already registred with another acc in this IP
    }
}
fclose(example);
And This put it after the registration:
pawn Код:
new fPiP[32];
format(fPiP, sizeof(fPiP), "%s\r\n", pIP);
new File:log = fopen("IPS.txt", io_write);
if(log)
{
    fwrite(log, fPiP);
    fclose(log);
}



Re: How to max 3 accounts on 1 IP - AmirRFCNR - 18.10.2014

i found this Include: https://sampforum.blast.hk/showthread.php?tid=321533

#define IP_LIMIT 3 // 3 players can connect from same IP


Re: How to max 3 accounts on 1 IP - TheNerka - 18.10.2014

i want loading from mysql
example: if 3 players have 127.0.0.1 can't register, and this new acc kick.


Re: How to max 3 accounts on 1 IP - Neil. - 18.10.2014

Quote:
Originally Posted by TheNerka
Посмотреть сообщение
i want loading from mysql
example: if 3 players have 127.0.0.1 can't register, and this new acc kick.
Here's an idea, Grab the IP on registration then store it with the player data. When a player registers, do a query and use COUNT() to get the number of accounts with the same Address. If the count is <= 3 then have the player registered otherwise, kick the player.


Re: How to max 3 accounts on 1 IP - Abagail - 18.10.2014

pawn Код:
new pIP[16];
GetPlayerIp(playerid, pIP, sizeof(pIP));
mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM `playerdata` WHERE `ip` = '%s'", pIP);
mysql_tquery(MySQLCon, query, "", "");
new numrows = cache_num_rows();
if(numrows >= 3) // then the player has 3 or more accounts with the IP.
This should work. It basically runs a query and then checks if 3 or more rows are returned. Change "playerdata" and "ip" to work with your gamemode/database.