01.07.2011, 11:01
Could someone tell me whats wrong with this code it aint saving
PHP код:
FamilyInfo[idx][FamilySkins]
PHP код:
public LoadFamilies()
{
new arrCoords[30][64];
new strFromFile2[512];
new File: file = fopen("families.cfg", io_read);
if(file)
{
new idx;
while (idx < sizeof(FamilyInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, '|');
FamilyInfo[idx][FamilyTaken] = strvalEx(arrCoords[0]);
strmid(FamilyInfo[idx][FamilyName], arrCoords[1], 0, strlen(arrCoords[1]), 255);
strmid(FamilyInfo[idx][FamilyMOTD], arrCoords[2], 0, strlen(arrCoords[2]), 255);
strmid(FamilyInfo[idx][FamilyLeader], arrCoords[3], 0, strlen(arrCoords[3]), 255);
FamilyInfo[idx][FamilyBank] = strvalEx(arrCoords[4]);
FamilyInfo[idx][FamilyCash] = strvalEx(arrCoords[5]);
FamilyInfo[idx][FamilySafe] = strvalEx(arrCoords[6]);
FamilyInfo[idx][FamilySafePos][0] = floatstr(arrCoords[7]);
FamilyInfo[idx][FamilySafePos][1] = floatstr(arrCoords[8]);
FamilyInfo[idx][FamilySafePos][2] = floatstr(arrCoords[9]);
FamilyInfo[idx][FamilyPot] = strvalEx(arrCoords[10]);
FamilyInfo[idx][FamilyCrack] = strvalEx(arrCoords[11]);
FamilyInfo[idx][FamilyMats] = strvalEx(arrCoords[12]);
strmid(FamilyRank[idx][0], arrCoords[13], 0, strlen(arrCoords[13]), 255);
strmid(FamilyRank[idx][1], arrCoords[14], 0, strlen(arrCoords[14]), 255);
strmid(FamilyRank[idx][2], arrCoords[15], 0, strlen(arrCoords[15]), 255);
strmid(FamilyRank[idx][3], arrCoords[16], 0, strlen(arrCoords[16]), 255);
strmid(FamilyRank[idx][4], arrCoords[17], 0, strlen(arrCoords[17]), 255);
strmid(FamilyRank[idx][5], arrCoords[18], 0, strlen(arrCoords[18]), 255);
FamilyInfo[idx][FamilyMembers] = strvalEx(arrCoords[19]);
FamilyInfo[idx][FamilySkins] = strvalEx(arrCoords[20]);
FamilyInfo[idx][FamilySkin1] = strvalEx(arrCoords[21]);
FamilyInfo[idx][FamilySkin2] = strvalEx(arrCoords[22]);
FamilyInfo[idx][FamilySkin3] = strvalEx(arrCoords[23]);
FamilyInfo[idx][FamilySkin4] = strvalEx(arrCoords[24]);
FamilyInfo[idx][FamilySkin5] = strvalEx(arrCoords[25]);
FamilyInfo[idx][FamilySkin6] = strvalEx(arrCoords[26]);
FamilyInfo[idx][FamilySkin7] = strvalEx(arrCoords[27]);
FamilyInfo[idx][FamilySkin8] = strvalEx(arrCoords[28]);
FamilyInfo[idx][FStrikes] = strval(arrCoords[29]);
printf("Family:%d Taken:%d Name:%s MOTD:%s Leader:%s Bank:%d Cash:%d Safe:%d SafeX:%f SafeY:%f SafeZ:%f Pot:%d Crack:%d Mats:%d Rank1:%s Rank2:%s Rank3:%s Rank4:%s Rank5:%s Rank6:%s Members:%d",
idx,FamilyInfo[idx][FamilyTaken],FamilyInfo[idx][FamilyName],FamilyInfo[idx][FamilyMOTD],
FamilyInfo[idx][FamilyLeader],FamilyInfo[idx][FamilyBank],
FamilyInfo[idx][FamilyCash],FamilyInfo[idx][FamilySafe],FamilyInfo[idx][FamilySafePos][0],
FamilyInfo[idx][FamilySafePos][1],FamilyInfo[idx][FamilySafePos][2],FamilyInfo[idx][FamilyPot],
FamilyInfo[idx][FamilyCrack],FamilyInfo[idx][FamilyMats],FamilyRank[idx][0],FamilyRank[idx][1],
FamilyRank[idx][2],FamilyRank[idx][3],FamilyRank[idx][4],FamilyRank[idx][5],FamilyInfo[idx][FamilyMembers]);
printf("Skins:%d Skin1:%d Skin2:%d Skin3:%d Skin4:%d Skin5:%d Skin6:%d Skin7:%d Skin8:%d",
FamilyInfo[idx][FamilySkins],FamilyInfo[idx][FamilySkin1],FamilyInfo[idx][FamilySkin2],FamilyInfo[idx][FamilySkin3],FamilyInfo[idx][FamilySkin4],
FamilyInfo[idx][FamilySkin5],FamilyInfo[idx][FamilySkin6],FamilyInfo[idx][FamilySkin7],FamilyInfo[idx][FamilySkin8]);
idx++;
}
fclose(file);
}
return 1;
}
public SaveFamilies()
{
new idx;
new File: file2;
while (idx < sizeof(FamilyInfo))
{
new coordsstring[512];
format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%s|%d|%d|%d|%f|%f|%f|%d|%d|%d|%s|%s|%s|%s|%s|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\n",
FamilyInfo[idx][FamilyTaken],
FamilyInfo[idx][FamilyName],
FamilyInfo[idx][FamilyMOTD],
FamilyInfo[idx][FamilyLeader],
FamilyInfo[idx][FamilyBank],
FamilyInfo[idx][FamilyCash],
FamilyInfo[idx][FamilySafe],
FamilyInfo[idx][FamilySafePos][0],
FamilyInfo[idx][FamilySafePos][1],
FamilyInfo[idx][FamilySafePos][2],
FamilyInfo[idx][FamilyPot],
FamilyInfo[idx][FamilyCrack],
FamilyInfo[idx][FamilyMats],
FamilyRank[idx][0],
FamilyRank[idx][1],
FamilyRank[idx][2],
FamilyRank[idx][3],
FamilyRank[idx][4],
FamilyRank[idx][5],
FamilyInfo[idx][FamilyMembers],
FamilyInfo[idx][FamilySkins],
FamilyInfo[idx][FamilySkin1],
FamilyInfo[idx][FamilySkin2],
FamilyInfo[idx][FamilySkin3],
FamilyInfo[idx][FamilySkin4],
FamilyInfo[idx][FamilySkin5],
FamilyInfo[idx][FamilySkin6],
FamilyInfo[idx][FamilySkin7],
FamilyInfo[idx][FamilySkin8],
FamilyInfo[idx][FStrikes]);
if(idx == 0)
{
file2 = fopen("families.cfg", io_write);
}
else
{
file2 = fopen("families.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}