Max Registrations From IP
#1

Hey guys, i know i've been here alot this night, but i wonder..
I've tried something which used to work but somehow no longer does.
I made a check, to see how much accounts a player has registered under ip X
If it contained more than 3 rows with the same IP the player was kicked.
However it no longer works, it doesn't function anymore

Код:
forward OnRegistrationCheck(playerid);
Код:
public OnRegistrationCheck(playerid)
{
      if(cache_get_row_count() >= 3) 
      {
      SendClientMessage(playerid, COLOR_WHITE, "{ff0000}[Server]:{ffffff} You have reached the max registered accounts on this IP, please use your previous account.");
      Kick(playerid);
  }
      return 1;
}
Код:
public OnAccountCheck(playerid)
{
        new rows, fields;
        cache_get_data(rows, fields, mysql);
        if(rows)
        {
                cache_get_field_content(0, "IP", IP[playerid], mysql, 16);
                new newIP[16];
                GetPlayerIp(playerid, newIP, 16);
                IsPlayerRegisterd[playerid] = 1;
                {
                        (!strlen(IP[playerid]) || strcmp(IP[playerid], newIP, true));
                        cache_get_field_content(0, "Password", pData[playerid][Password], mysql, 129);
                        pData[playerid][ID] = cache_get_field_content_int(0, "ID");
                        ShowPlayerDialog(playerid, dLOGIN, DIALOG_STYLE_PASSWORD, "Login", "In order to play, you need to login", "Login", "Quit");
                }
        }
        else
        {
        			 new pIP[16], query[72];
					 GetPlayerIp(playerid, pIP, sizeof(pIP));
					 mysql_format(mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `IP` = '%s'", pIP);
					 mysql_tquery(mysql, query, "OnRegistrationCheck", "s", playerid);
                	 ShowPlayerDialog(playerid, dREGISTER, DIALOG_STYLE_PASSWORD, "Register", "In order to play, you need to register.", "Register", "Quit");
        }

        return 1;
}
Is it because the IP is fetched as a string?
Reply


Messages In This Thread
Max Registrations From IP - by yvoms - 21.01.2016, 22:21
Re: Max Registrations From IP - by Jefff - 21.01.2016, 22:25
Re: Max Registrations From IP - by Vince - 21.01.2016, 22:33
Re: Max Registrations From IP - by yvoms - 21.01.2016, 22:34
Re: Max Registrations From IP - by Jefff - 21.01.2016, 23:04
Re: Max Registrations From IP - by yvoms - 21.01.2016, 23:14

Forum Jump:


Users browsing this thread: 1 Guest(s)