MySQL showing total members in factions/online members.
#7

There is nothing in your script that gives us information about the 'total members'.
So I just added the currently online members. Should work.
Код:
CMD:factions(playerid,params[]) 
{
    mysql_tquery(mysql, "SELECT a.factionid, f.Name, COUNT(a.factionid) AS memberCount FROM `Accounts` a INNER JOIN `Faction` f ON f.ID = a.factionid GROUP BY a.factionid, f.Name", "LoadFactionsIG", "i", playerid);
    return 1; 
}

forward LoadFactionsIG(playerid); 
public LoadFactionsIG(playerid) 
{ 
    if(!IsPlayerConnected(playerid))
            return 1;

    new rows = cache_get_row_count(mysql);
    if(!rows)
        return 1; 

    new fName[32], dString[MAX_FACTIONS * (32+6) +1]; 
    for (new i; i < rows; i++) 
    { 
        cache_get_field_content(i, "Name", fName, mysql); 
        format(dString, sizeof(dString), "%s%s\t%i\n", dString, fName, cache_get_field_content_int(i, "memberCount", mysql));   
    }
    ShowPlayerDialog(playerid, 10, DIALOG_STYLE_MSGBOX, "Factions", dString, "OK",""); 
    return 1; 
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)