enum familyInfo { FamilyExists, FamilyName[32], FamilyStrikes, FamilyRanks, FamilyRank1[24], FamilyRank2[24], FamilyRank3[24], FamilyRank4[24], FamilyRank5[24], FamilyRank6[24], FamilyRank7[24], FamilyRank8[24], FamilyRank9[24], FamilyRank10[24], FamilyRank11[24], FamilyRank12[24], FamilyRank13[24], FamilyRank14[24], FamilyRank15[24] } new FamilyInfo[MAX_FAMILIES][familyInfo];
LoadFamilies() { new string[24], rank[24]; for (new i; i < MAX_FAMILIES; i++) if (dini_Exists(GetFamilyFile(i))) { format(FamilyInfo[i][FamilyName], 32, dini_Get(GetFamilyFile(i), "Name")); FamilyInfo[i][FamilyExists] = true; FamilyInfo[i][FamilyStrikes] = dini_Int(GetFamilyFile(i), "Strikes")); //line 1670 FamilyInfo[i][FamilyRanks] = dini_Int(GetFamilyFile(i), "Ranks")); for (new j = 1; j <= 15; j++) { format(string, sizeof(string), "Rank%d", j); format(rank, sizeof(rank), dini_Get(GetFamilyFile(i), string)); format(string, sizeof(string), "FamilyRank%d", j); format(FamilyInfo[i][string], 24, rank); } } }
(1670) : error 001: expected token: ";", but found ")" (1670) : error 029: invalid expression, assumed zero (1670) : warning 215: expression has no effect (1671) : error 001: expected token: ";", but found ")" (1671) : error 029: invalid expression, assumed zero (1671) : warning 215: expression has no effect (1679) : error 033: array must be indexed (variable "string")
format(FamilyInfo[i][FamilyRank1], 24, dini_Get(GetFamilyFile(i), "Rank1")); format(FamilyInfo[i][FamilyRank2], 24, dini_Get(GetFamilyFile(i), "Rank2")); format(FamilyInfo[i][FamilyRank3], 24, dini_Get(GetFamilyFile(i), "Rank3")); ...to be continued
FamilyInfo[i][FamilyStrikes] = dini_Int(GetFamilyFile(i), "Strikes")); //line 1670
To
FamilyInfo[i][FamilyStrikes] = dini_Int(GetFamilyFile(i), "Strikes"); //line 1670
FamilyInfo[i][FamilyRanks] = dini_Int(GetFamilyFile(i), "Ranks")); //line 1671
To
FamilyInfo[i][FamilyRanks] = dini_Int(GetFamilyFile(i), "Ranks");
AND
format(FamilyInfo[i][string], 24, rank); // string error
TO
format(FamilyInfo[i][string], 24, "%i", rank);
pawn Код:
|
pawn Код:
|
for (new index = 35; index <= 371; index += 24)
{
// using "FamilyInfo[5][familyInfo: index]"
}
The items in the enumerators are constants, not literal strings. If you do not modify the size of the ranks and/or add/remove ranks or add other items before the ranks (order), this will work:
pawn Код:
|
printf("FamilyRank1: %i\nFamilyRank15: %i", FamilyRank1, FamilyRank15);
// output:
FamilyRank1: 35
FamilyRank15: 371
LoadFamilies() { new string[24], rank[24], number; for (new i; i < MAX_FAMILIES; i++) if (dini_Exists(GetFamilyFile(i))) { format(FamilyInfo[i][FamilyName], 32, dini_Get(GetFamilyFile(i), "Name")); FamilyInfo[i][FamilyExists] = true; FamilyInfo[i][FamilyStrikes] = dini_Int(GetFamilyFile(i), "Strikes"); FamilyInfo[i][FamilyRanks] = dini_Int(GetFamilyFile(i), "Ranks"); for (new index = 35; index <= 371; index += 24) { number++; format(string, sizeof(string), "Rank%d", number); format(rank, sizeof(rank), dini_Get(GetFamilyFile(i), string)); format(FamilyInfo[i][familyInfo:index], 24, rank); } } }
for (new index = 35, number = 1; index <= 371; index += 24, number++)
{
format(string, sizeof(string), "Rank%d", number);
strcat(FamilyInfo[i][familyInfo: index], dini_Get(GetFamilyFile(i), string), 24);
}