How to max 3 accounts on 1 IP
#1

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

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);
}
Reply
#3

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

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

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

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.
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)