Also-Known-As [MySQL]
#3

Use MySQL wildcards and here's how your code should look like:

You can use some wildcard magic to detect similar IPs.

PHP Code:
mysql_format(mysqlquerysizeof query"SELECT * FROM `accounts` WHERE `IP` = '%s'"PlayerInfo[playerid][p_newIP]);
mysql_pquery(mysqlquery"CheckAKA""i"playerid); 
PHP Code:
forward CheckAKA(playerid);
public 
CheckAKA(playerid) {

    new
        
rowsip[18];

    
cache_get_row_count(rows);

    for (new 
irowsi++) {

        
cache_get_value_name(i"IP"ip);

        if (
IpMatch(ipPlayerInfo[playerid][p_newIP]))
            
count ++;
    }

    if (
count) {
        
format(querysizeof(query), "[Warning] "white"%s may have connected before to the server with a different name. (/aka %d)"GetName(playerid), playerid);
        
        foreach (new 
Player) {
            if (!
PlayerInfo[i][p_Admin])
                continue;

            
SendClientMessage(iCOLOR_REDquery);
        }
    }

    return 
1;

Reply


Messages In This Thread
Also-Known-As [MySQL] - by JaKe Elite - 23.01.2019, 14:22
Re: Also-Known-As [MySQL] - by Calisthenics - 23.01.2019, 15:39
Re: Also-Known-As [MySQL] - by Logic_ - 23.01.2019, 17:54

Forum Jump:


Users browsing this thread: 1 Guest(s)