15.02.2018, 11:49
Hello!
I have command /factions which showing all the factions of my server.
The problem is that is showing just those factions who have more than 1 member.
How to change the query to show all the factions even if one of them is empty?
Command:
What I tried?
I tried to change
to
and
I have command /factions which showing all the factions of my server.
The problem is that is showing just those factions who have more than 1 member.
How to change the query to show all the factions even if one of them is empty?
Command:
Код HTML:
CMD:factions(playerid, params[])
{
#pragma unused params
new
output[1024] = "Name\tMembers\tStats\tLv",
Cache:result7 = mysql_query(handle, "SELECT playerGroup, COUNT(*) AS members FROM playeraccounts GROUP BY playerGroup HAVING members > 0 ORDER BY playerGroup");
for(new i, j = cache_get_row_count(); i < j; i++)
{
new
groupId = cache_get_row_int(i, 0, handle),
members = cache_get_row_int(i, 1, handle);
if(0 <= groupId < 16)
{
new temp[128];
format(temp, sizeof(temp),"{%s}%s\t[%d/%d]\t%s\tLevel %d\n",
groupVariables[groupId][gColor],
groupVariables[groupId][gGroupName],
members,
groupVariables[groupId][gSlots],
(groupVariables[groupId][gGroupAplication] == 1) ? ("Recruit") : ("Don't recruit"),
groupVariables[groupId][gGroupLvl]
);
strcat(output, temp);
}
}
cache_delete(result7);
ShowPlayerDialog(playerid, 4500, DIALOG_STYLE_TABLIST_HEADERS, "Factions", output, "Select", "Cancel");
return 1;
}
I tried to change
Код HTML:
mysql_query(handle, "SELECT playerGroup, COUNT(*) AS members FROM playeraccounts GROUP BY playerGroup HAVING members > 0 ORDER BY playerGroup");
Код HTML:
mysql_query(handle, "SELECT playerGroup, COUNT(*) AS members FROM playeraccounts GROUP BY playerGroup ORDER BY playerGroup");
Код HTML:
mysql_query(handle, "SELECT playerGroup, COUNT(*) AS members FROM playeraccounts GROUP BY playerGroup HAVING members >= 0 ORDER BY playerGroup");

