Ballas owns 0 territories Ballas owns 0 territories |
Grove owns 0 territories Ballas owns 0 territories |
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;
}
new TerritoryString[2560];
format(TerritoryString, sizeof(TerritoryString), "{%06x}%s%s owns %d territories.\n", COLOR_FACTIONS >>> 8, TerritoryString, array[i][E_TEAMNAME], array[i][E_TERRITORIESWON]);
new
territoryString[1024],
territoryStringTemp[128]
;
for(new i = 0; i < MAX_FACTIONS; i++) {
format(string2, sizeof string2, "/Factions/%d.dini.save", i);
if(!dini_Exists(string2))
break;
format(territoryStringTemp, sizeof territoryStringTemp, "{%06x}%s%s owns %d territories.\n", COLOR_FACTIONS >>> 8, TerritoryString, array[i][E_TEAMNAME], array[i][E_TERRITORIESWON]);
strcat(territoryString, territoyStringTemp);
}
ShowPlayerDialog(playerid,29,DIALOG_STYLE_MSGBOX, "{82FFFF}Territories:", territoryString, "{FF0000}Close", "");
PHP код:
PHP код:
PHP код:
|
Ballas = 0 [1 Win] Grove = 1 [0 Wins] White = 2 [3 Wins]
White = 2 [3 Wins] Ballas = 0 [1 Win] Grove = 1 [0 Wins]
for(new i = 0; i < MAX_FACTIONS; i++) {
array[i][E_TEAMNAME], array[i][E_TERRITORIESWON]
}
Start by debugging your code, check what "array" contains after the first loop, debug the entries that get put into the array in the first loop, do approximately the same for the second loop.
By the way, you're sorting the array by territories won, the second loop will mix up the ids; Код:
Ballas = 0 [1 Win] Grove = 1 [0 Wins] White = 2 [3 Wins] Код:
White = 2 [3 Wins] Ballas = 0 [1 Win] Grove = 1 [0 Wins] PHP код:
|
Is the command used to simply show how many territories a gang has?
|