Select one or more from mysql db
#1

Any example how to make that when I in game write a command /detect ip [ip], and that it searches through mysql database and if finds one or more matching IPs to send client message?
Reply
#2

Actually we know nothing about your db, so it would be quite hard.
Reply
#3

to search through table players and find one or more matching IPs
Reply
#4

Is this what you're looking for?

PHP код:
public OnPlayerConnect(playerid)
{
    new 
query[200]; 
    
mysql_format(Databasequerysizeof query"SELECT * FROM `users` WHERE `IP` = '%e'"PlayerIP[playerid]);  
    
mysql_tquery(Databasequery"MultiAccountCheck""i"playerid);     
    return 
1;
}
forward MultiAccountCheck(playerid); 
public 
MultiAccountCheck(playerid

    new 
string[256];  
    for(new 
icache_num_rows(); i++)
    { 
        if(
cache_num_rows() >= 2)
        {
            
TogglePlayerSpectating(playeridtrue);
            
Dialog_Close(playerid);
            
format(stringsizeof(string), "{FFFFFF}You already have {AA3333}%d accounts{FFFFFF} registred on our database with the actual IP: {AA3333}(%s)"cache_num_rows()-1PlayerIP[playerid]);
            
// KickEx(playerid);
            
Dialog_Show(playeridMULTIACCOUNT_KICKDIALOG_STYLE_MSGBOX"Multi-account detected"string"OK"""); 
        }
    }
    return 
1

This is a snippet from my actual gamemode.
Reply
#5

Thanks, +repped that's the example I needed.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)