Is there a smarter way to do this ?
#1

Hey guys, this is a mysql CMD to retrieve all registered accounts on an IP address, do you have any suggestions to make it faster & more efficient ?
PHP код:
CMD:checkalts(playeridparams[])
{
    if(!
IsAllowed(playerid3)) return NoAuth(playerid);
    new 
playerb;
    if(
sscanf(params"u"playerb)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /checkalts [playerid]");
    if(!
IsPlayerConnected(playerb)) return SendClientMessage(playeridCOLOR_WHITE"Invalid ID.");
    if(
IsImmune(playeridplayerb)) return NotImmune(playerid);
    new 
query[128], Cache:resultrowstempname[24], tempdate[12];
    
mysql_format(mysqlquerysizeof(query), "SELECT `Username`, `Score`, `Registration` FROM `Users` WHERE `IP`='%s' ORDER BY `UserID`"RPIP(playerb));
    
result mysql_query(mysqlquery);
    
rows cache_get_row_count(mysql);
    
format(querysizeof(query), "Active & Registered accounts on %s."RPIP(playerb));
    
SendClientMessage(playeridCOLOR_REPORTquery);
    if(
rows)
    {
        for(new 
0rowsi++)
        {
            
cache_get_field_content(i"Username"tempnamemysqlsizeof(tempname));
            
cache_get_field_content(i"Registration"tempdatemysqlsizeof(tempdate));
            
format(querysizeof(query), "Username: %s || Registration Date: %s || Score: %d"tempnametempdatecache_get_field_content_int(i"Score"));
            
SendClientMessage(playeridCOLOR_REDquery);
        }
    }
    
cache_delete(result);
    return 
1;

Reply


Messages In This Thread
Is there a smarter way to do this ? - by NeXoR - 28.10.2016, 08:54
Re: Is there a smarter way to do this ? - by oMa37 - 28.10.2016, 09:14
Re: Is there a smarter way to do this ? - by NeXoR - 28.10.2016, 09:22
Re: Is there a smarter way to do this ? - by oMa37 - 28.10.2016, 10:17
Re: Is there a smarter way to do this ? - by Threshold - 28.10.2016, 11:13
Re: Is there a smarter way to do this ? - by oMa37 - 28.10.2016, 11:21
Re: Is there a smarter way to do this ? - by AndySedeyn - 28.10.2016, 11:32
Re: Is there a smarter way to do this ? - by Threshold - 28.10.2016, 13:14

Forum Jump:


Users browsing this thread: 2 Guest(s)