02.10.2010, 06:55
Hello,i got a problem with factions,if i go ingame,i make myself a leader of faction id 8(the problem its same for every id) then i change settings,like faction name,faction skins etc...and if i restart the server it resets it,but if i set HQ somewhere then it will save there...
heres the load and save
heres the load and save
Код:
public LoadFamilies() { new arrCoords[36][64]; new strFromFile2[256]; new File: file = fopen("families.cfg", io_read); if (file) { new idx; while (idx < sizeof(FamilyInfo)) { fread(file, strFromFile2); split(strFromFile2, arrCoords, '|'); strmid(FamilyInfo[idx][FamilyName], arrCoords[1], 0, strlen(arrCoords[0]), 255); strmid(FamilyInfo[idx][FamilyMOTD], arrCoords[2], 0, strlen(arrCoords[1]), 255); FamilyInfo[idx][FamilySpawn][0] = floatstr(arrCoords[3]); FamilyInfo[idx][FamilySpawn][1] = floatstr(arrCoords[4]); FamilyInfo[idx][FamilySpawn][2] = floatstr(arrCoords[5]); FamilyInfo[idx][FamilyExit][0] = floatstr(arrCoords[6]); FamilyInfo[idx][FamilyExit][1] = floatstr(arrCoords[7]); FamilyInfo[idx][FamilyExit][2] = floatstr(arrCoords[8]); strmid(FamilyInfo[idx][FamilyRank1], arrCoords[9], 0, strlen(arrCoords[8]), 255); strmid(FamilyInfo[idx][FamilyRank2], arrCoords[10], 0, strlen(arrCoords[9]), 255); strmid(FamilyInfo[idx][FamilyRank3], arrCoords[11], 0, strlen(arrCoords[10]), 255); strmid(FamilyInfo[idx][FamilyRank4], arrCoords[12], 0, strlen(arrCoords[11]), 255); strmid(FamilyInfo[idx][FamilyRank5], arrCoords[13], 0, strlen(arrCoords[12]), 255); strmid(FamilyInfo[idx][FamilyRank6], arrCoords[14], 0, strlen(arrCoords[13]), 255); FamilyInfo[idx][FamilySkin1] = strval(arrCoords[15]); FamilyInfo[idx][FamilySkin2] = strval(arrCoords[16]); FamilyInfo[idx][FamilySkin3] = strval(arrCoords[17]); FamilyInfo[idx][FamilySkin4] = strval(arrCoords[18]); FamilyInfo[idx][FamilySkin5] = strval(arrCoords[19]); FamilyInfo[idx][FamilySkin6] = strval(arrCoords[20]); FamilyInfo[idx][FamilyInterior] = strval(arrCoords[21]); FamilyInfo[idx][FamilyDrugs] = strval(arrCoords[22]); FamilyInfo[idx][FamilyMats] = strval(arrCoords[23]); FamilyInfo[idx][FamilyMoney] = strval(arrCoords[24]); FamilyInfo[idx][FamilyLocked] = strval(arrCoords[25]); FamilyInfo[idx][FamilyGun][0] = strval(arrCoords[26]); FamilyInfo[idx][FamilyGun][1] = strval(arrCoords[27]); FamilyInfo[idx][FamilyGun][2] = strval(arrCoords[28]); FamilyInfo[idx][FamilyGun][3] = strval(arrCoords[29]); FamilyInfo[idx][FamilyAmmo][0] = strval(arrCoords[30]); FamilyInfo[idx][FamilyAmmo][1] = strval(arrCoords[31]); FamilyInfo[idx][FamilyAmmo][2] = strval(arrCoords[32]); FamilyInfo[idx][FamilyAmmo][3] = strval(arrCoords[33]); FamilyInfo[idx][FamilyMembers] = strval(arrCoords[34]); FamilyInfo[idx][FamilyIden] = strval(arrCoords[35]); idx++; } fclose(file); } return 1; } public SaveFamilies() { new idx; new File: file2; while (idx < sizeof(FamilyInfo)) { new coordsstring[256]; format(coordsstring, sizeof(coordsstring), "%s|%s|%f|%f|%f|%f|%f|%f|%s|%s|%s|%s|%s|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\n", FamilyInfo[idx][FamilyName], FamilyInfo[idx][FamilyMOTD], FamilyInfo[idx][FamilySpawn][0], FamilyInfo[idx][FamilySpawn][1], FamilyInfo[idx][FamilySpawn][2], FamilyInfo[idx][FamilyExit][0], FamilyInfo[idx][FamilyExit][1], FamilyInfo[idx][FamilyExit][2], FamilyInfo[idx][FamilyRank1], FamilyInfo[idx][FamilyRank2], FamilyInfo[idx][FamilyRank3], FamilyInfo[idx][FamilyRank4], FamilyInfo[idx][FamilyRank5], FamilyInfo[idx][FamilyRank6], FamilyInfo[idx][FamilySkin1], FamilyInfo[idx][FamilySkin2], FamilyInfo[idx][FamilySkin3], FamilyInfo[idx][FamilySkin4], FamilyInfo[idx][FamilySkin5], FamilyInfo[idx][FamilySkin6], FamilyInfo[idx][FamilyInterior], FamilyInfo[idx][FamilyDrugs], FamilyInfo[idx][FamilyMats], FamilyInfo[idx][FamilyMoney], FamilyInfo[idx][FamilyLocked], FamilyInfo[idx][FamilyGun][0], FamilyInfo[idx][FamilyGun][1], FamilyInfo[idx][FamilyGun][2], FamilyInfo[idx][FamilyGun][3], FamilyInfo[idx][FamilyAmmo][0], FamilyInfo[idx][FamilyAmmo][1], FamilyInfo[idx][FamilyAmmo][2], FamilyInfo[idx][FamilyAmmo][3], FamilyInfo[idx][FamilyMembers], FamilyInfo[idx][FamilyIden]); if(idx == 0) { file2 = fopen("families.cfg", io_write); } else { file2 = fopen("families.cfg", io_append); } fwrite(file2, coordsstring); idx++; fclose(file2); } return 1; }