15.11.2017, 17:43
Hello guys! I have a problem, when I type /territories to see all territories of the factions/gangs and if the factions/gangs like Ballas and Grove owns 0 territories it says:
I mean 2 times that, instead of:
There is the code of sorting the territories:
EDITED: +1 REP if You help me
Quote:
Ballas owns 0 territories Ballas owns 0 territories |
Quote:
Grove owns 0 territories Ballas owns 0 territories |
PHP код:
cmd:Territories(playerid, params[])
{
new FactionNamee[255], string2[256];
enum ENUM_GANG
{
E_TEAMNAME[32],
E_TERRITORIESWON
};
new SIZE_ENUM_GANG[ENUM_GANG];
new array[MAX_FACTIONS][ENUM_GANG];
for(new i = 0; i < MAX_FACTIONS; i++)
{
format(string2, sizeof(string2), "/Factions/%d.dini.save", i);
if(dini_Exists(string2))
{
FactionNamee = dini_Get(string2,"FactionName");
}
strcpy(array[i][E_TEAMNAME], FactionNamee, sizeof(SIZE_ENUM_GANG[E_TEAMNAME]));
array[i][E_TERRITORIESWON] = FactionInfo[i][tWons];
}
SortDeepArray(array, E_TERRITORIESWON, .order = SORT_DESC);
new TerritoryString[2560];
for(new i = 0; i < MAX_FACTIONS; i++)
{
format(string2, sizeof(string2), "/Factions/%d.dini.save", i);
if(!dini_Exists(string2))
{
break;
}
format(TerritoryString, sizeof(TerritoryString), "{%06x}%s%s owns %d territories.\n", COLOR_FACTIONS >>> 8, TerritoryString, array[i][E_TEAMNAME], array[i][E_TERRITORIESWON]);
}
ShowPlayerDialog(playerid,29,DIALOG_STYLE_MSGBOX, "{82FFFF}Territories:", TerritoryString, "{FF0000}Close", "");
SIZE_ENUM_GANG[E_TERRITORIESWON] = 0;
return 1;
}