23.01.2019, 17:54
Use MySQL wildcards and here's how your code should look like:
You can use some wildcard magic to detect similar IPs.
You can use some wildcard magic to detect similar IPs.
PHP Code:
mysql_format(mysql, query, sizeof query, "SELECT * FROM `accounts` WHERE `IP` = '%s'", PlayerInfo[playerid][p_newIP]);
mysql_pquery(mysql, query, "CheckAKA", "i", playerid);
PHP Code:
forward CheckAKA(playerid);
public CheckAKA(playerid) {
new
rows, ip[18];
cache_get_row_count(rows);
for (new i; i < rows; i++) {
cache_get_value_name(i, "IP", ip);
if (IpMatch(ip, PlayerInfo[playerid][p_newIP]))
count ++;
}
if (count) {
format(query, sizeof(query), "[Warning] "white"%s may have connected before to the server with a different name. (/aka %d)", GetName(playerid), playerid);
foreach (new i : Player) {
if (!PlayerInfo[i][p_Admin])
continue;
SendClientMessage(i, COLOR_RED, query);
}
}
return 1;
}