12.02.2013, 15:52
For some reason when I Run this gamemode it crashes at OnGameModeInit() At this specific spot:
When I Delete the Families.cgf then run the Game Mode it works perfectly but then when I restart it will Crash because I guess it can't Load the Families.cgf
Heres my Load and Save Families.
Anyone See this issue? I'm stumped!
Код:
LoadFamilies();
When I Delete the Families.cgf then run the Game Mode it works perfectly but then when I restart it will Crash because I guess it can't Load the Families.cgf
Heres my Load and Save Families.
Код:
SaveFamilies() { new idx; new File: file2; while (idx < sizeof(FamilyInfo)) { new coordsstring[790]; format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%d|%s|%d|%f|%f|%f|%f|%d|%s|%s|%s|%s|%s|%s|%d|%d|%d|%d|%d|%d\n", FamilyInfo[idx][FamilyTaken], FamilyInfo[idx][FamilyName], FamilyInfo[idx][FamilyMOTD], FamilyInfo[idx][FamilyColor], FamilyInfo[idx][FamilyLeader], FamilyInfo[idx][FamilyMembers], FamilyInfo[idx][FamilySpawn][0], FamilyInfo[idx][FamilySpawn][1], FamilyInfo[idx][FamilySpawn][2], FamilyInfo[idx][FamilySpawn][3], FamilyInfo[idx][FamilyInterior], FamilyRank[idx][0], FamilyRank[idx][1], FamilyRank[idx][2], FamilyRank[idx][3], FamilyRank[idx][4], FamilyRank[idx][5], FamilyInfo[idx][FamilySkin1], FamilyInfo[idx][FamilySkin2], FamilyInfo[idx][FamilySkin3], FamilyInfo[idx][FamilySkin4], FamilyInfo[idx][FamilySkin5], FamilyInfo[idx][FamilySkin6]); if(idx == 0) { file2 = fopen("LARP/Families/families.cfg", io_write); } else { file2 = fopen("LARP/Families/families.cfg", io_append); } fwrite(file2, coordsstring); idx++; fclose(file2); } return 1; } LoadFamilies() { new arrCoords[23][64]; new strFromFile2[256]; new File: file = fopen("LARP/Families/families.cfg", io_read); if (file) { new idx; while (idx < sizeof(FamilyInfo)) { fread(file, strFromFile2); split(strFromFile2, arrCoords, '|'); FamilyInfo[idx][FamilyTaken] = strval(arrCoords[0]); strmid(FamilyInfo[idx][FamilyName], arrCoords[1], 0, strlen(arrCoords[1]), 255); strmid(FamilyInfo[idx][FamilyMOTD], arrCoords[2], 0, strlen(arrCoords[2]), 255); FamilyInfo[idx][FamilyColor] = strlen(arrCoords[3]); strmid(FamilyInfo[idx][FamilyLeader], arrCoords[4], 0, strlen(arrCoords[3]), 255); FamilyInfo[idx][FamilyMembers] = strval(arrCoords[5]); FamilyInfo[idx][FamilySpawn][0] = floatstr(arrCoords[6]); FamilyInfo[idx][FamilySpawn][1] = floatstr(arrCoords[7]); FamilyInfo[idx][FamilySpawn][2] = floatstr(arrCoords[8]); FamilyInfo[idx][FamilySpawn][3] = floatstr(arrCoords[9]); FamilyInfo[idx][FamilyInterior] = strval(arrCoords[10]); strmid(FamilyRank[idx][0], arrCoords[11], 0, strlen(arrCoords[11]), 255); strmid(FamilyRank[idx][1], arrCoords[12], 0, strlen(arrCoords[12]), 255); strmid(FamilyRank[idx][2], arrCoords[13], 0, strlen(arrCoords[13]), 255); strmid(FamilyRank[idx][3], arrCoords[14], 0, strlen(arrCoords[14]), 255); strmid(FamilyRank[idx][4], arrCoords[15], 0, strlen(arrCoords[15]), 255); strmid(FamilyRank[idx][5], arrCoords[16], 0, strlen(arrCoords[16]), 255); FamilyInfo[idx][FamilySkin1] = strval(arrCoords[17]); FamilyInfo[idx][FamilySkin2] = strval(arrCoords[18]); FamilyInfo[idx][FamilySkin3] = strval(arrCoords[19]); FamilyInfo[idx][FamilySkin4] = strval(arrCoords[20]); FamilyInfo[idx][FamilySkin5] = strval(arrCoords[21]); FamilyInfo[idx][FamilySkin6] = strval(arrCoords[22]); //printf("Family:%d Taken: %d Name:%s MOTD:%s Leader:%s Members:%d SpawnX:%f SpawnY:%f SpawnZ:%f Int:%d", //idx,FamilyInfo[idx][FamilyTaken],FamilyInfo[idx][FamilyName],FamilyInfo[idx][FamilyMOTD],FamilyInfo[idx][FamilyLeader],FamilyInfo[idx][FamilyMembers],FamilyInfo[idx][FamilySpawn][0],FamilyInfo[idx][FamilySpawn][1],FamilyInfo[idx][FamilySpawn][2],FamilyInfo[idx][FamilyInterior]); idx++; } fclose(file); } return 1; }
Код:
enum fInfo { FamilyColor[20], Float:FamilySpawn[4], Float:FamilyExit[3], FamilyInterior, FamilyTaken, FamilyName[32], FamilyMOTD[64], FamilyLeader[MAX_PLAYER_NAME], FamilyBank, FamilyCash, FamilySafe, Float:FamilySafePos[3], FamilyWeed, FamilyCocaine, FamilyMats, FamilyMembers, FamilySkins, FamilySkin1, FamilySkin2, FamilySkin3, FamilySkin4, FamilySkin5, FamilySkin6, FamilySkin7, FamilySkin8, FamilyVirtual, PickupID, FStrikes, Colt45, Shotgun, MP5, AK47, M4, SPAS12, Rifle, Sniper, FamilyHQ, FAlliance[32], FAllied }; new FamilyInfo[30][fInfo]; new FamilyRank[20][6][24];