21.01.2016, 22:21
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
Is it because the IP is fetched as a string?
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;
}

