18.10.2014, 10:23
How to register system for max 3 accounts on 1 IP? using mysql r38
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);
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);
}
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.