Faction Problem! [HELP!!] -
hewittpro - 12.02.2013
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.
Код:
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];
Anyone See this issue? I'm stumped!
Re: Faction Problem! [HELP!!] -
hewittpro - 13.02.2013
Bump
Re: Faction Problem! [HELP!!] -
LocMax - 13.02.2013
delete
Re: Faction Problem! [HELP!!] -
hewittpro - 13.02.2013
Why Delete?
Re: Faction Problem! [HELP!!] -
hewittpro - 14.02.2013
Why Delete? Seriously, Im curious.
Re: Faction Problem! [HELP!!] -
faff - 14.02.2013
Код:
stock LoadFamilies()
{
new finfo[62][48];
new string[512];
new File:file = fopen("families.cfg", io_read);
if(file)
{
new idx = 1;
while(idx < MAX_FAMILIES)
{
fread(file, string);
split(string, finfo, '|');
FamInfo[idx][fTaken] = strval(finfo[0]);
format(FamInfo[idx][fName], 32, "%s", finfo[1]);
format(FamInfo[idx][fMOTD], 64, "%s", finfo[2]);
FamInfo[idx][fColor] = strval(finfo[3]);
format(FamInfo[idx][fLeader], MAX_PLAYER_NAME, "%s", finfo[4]);
FamInfo[idx][fMembers] = strval(finfo[5]);
FamInfo[idx][fSafeX] = floatstr(finfo[6]);
FamInfo[idx][fSafeY] = floatstr(finfo[7]);
FamInfo[idx][fSafeZ] = floatstr(finfo[8]);
FamInfo[idx][fMoney] = strval(finfo[9]);
FamInfo[idx][fMats] = strval(finfo[10]);
FamInfo[idx][fWeed] = strval(finfo[11]);
FamInfo[idx][fCrack] = strval(finfo[12]);
format(FamInfo[idx][fRank1], 32, "%s", finfo[13]);
format(FamInfo[idx][fRank2], 32, "%s", finfo[14]);
format(FamInfo[idx][fRank3], 32, "%s", finfo[15]);
format(FamInfo[idx][fRank4], 32, "%s", finfo[16]);
format(FamInfo[idx][fRank5], 32, "%s", finfo[17]);
format(FamInfo[idx][fRank6], 32, "%s", finfo[18]);
FamInfo[idx][fSkins][0] = strval(finfo[19]);
FamInfo[idx][fSkins][1] = strval(finfo[20]);
FamInfo[idx][fSkins][2] = strval(finfo[21]);
FamInfo[idx][fSkins][3] = strval(finfo[22]);
FamInfo[idx][fSkins][4] = strval(finfo[23]);
FamInfo[idx][fSkins][5] = strval(finfo[24]);
FamInfo[idx][fSkins][6] = strval(finfo[25]);
FamInfo[idx][fStrikes] = strval(finfo[26]);
FamInfo[idx][fVehType][0] = strval(finfo[27]);
FamInfo[idx][fVehType][1] = strval(finfo[28]);
FamInfo[idx][fVehType][2] = strval(finfo[29]);
FamInfo[idx][fVehType][3] = strval(finfo[30]);
FamInfo[idx][fVehType][4] = strval(finfo[31]);
FamInfo[idx][fVehCoX][0] = floatstr(finfo[32]);
FamInfo[idx][fVehCoY][0] = floatstr(finfo[33]);
FamInfo[idx][fVehCoZ][0] = floatstr(finfo[34]);
FamInfo[idx][fVehCoX][1] = floatstr(finfo[35]);
FamInfo[idx][fVehCoY][1] = floatstr(finfo[36]);
FamInfo[idx][fVehCoZ][1] = floatstr(finfo[37]);
FamInfo[idx][fVehCoX][2] = floatstr(finfo[38]);
FamInfo[idx][fVehCoY][2] = floatstr(finfo[39]);
FamInfo[idx][fVehCoZ][2] = floatstr(finfo[40]);
FamInfo[idx][fVehCoX][3] = floatstr(finfo[41]);
FamInfo[idx][fVehCoY][3] = floatstr(finfo[42]);
FamInfo[idx][fVehCoZ][3] = floatstr(finfo[43]);
FamInfo[idx][fVehCoX][4] = floatstr(finfo[44]);
FamInfo[idx][fVehCoY][4] = floatstr(finfo[45]);
FamInfo[idx][fVehCoZ][4] = floatstr(finfo[46]);
FamInfo[idx][fVehRot][0] = strval(finfo[47]); // Rot
FamInfo[idx][fVehRot][1] = strval(finfo[48]);
FamInfo[idx][fVehRot][2] = strval(finfo[49]);
FamInfo[idx][fVehRot][3] = strval(finfo[50]);
FamInfo[idx][fVehRot][4] = strval(finfo[51]);
FamInfo[idx][fVehCol1][0] = strval(finfo[52]); // Colors
FamInfo[idx][fVehCol1][1] = strval(finfo[53]);
FamInfo[idx][fVehCol1][2] = strval(finfo[54]);
FamInfo[idx][fVehCol1][3] = strval(finfo[55]);
FamInfo[idx][fVehCol1][4] = strval(finfo[56]);
FamInfo[idx][fVehCol2][0] = strval(finfo[57]);
FamInfo[idx][fVehCol2][1] = strval(finfo[58]);
FamInfo[idx][fVehCol2][2] = strval(finfo[59]);
FamInfo[idx][fVehCol2][3] = strval(finfo[60]);
FamInfo[idx][fVehCol2][4] = strval(finfo[61]);
if(FamInfo[idx][fSafeX] != 0 && FamInfo[idx][fSafeY] != 0 && FamInfo[idx][fSafeZ] != 0)
{
FamInfo[idx][fPickup] = CreateDynamicPickup(1239, 1, FamInfo[idx][fSafeX], FamInfo[idx][fSafeY], FamInfo[idx][fSafeZ], -1);
format(string, sizeof(string), "%s's Safe", FamInfo[idx][fName]);
FamInfo[idx][fText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, FamInfo[idx][fSafeX], FamInfo[idx][fSafeY], FamInfo[idx][fSafeZ]+0.3, 15);
}
for(new i=0; i<5; i++)
{
if(FamInfo[idx][fVehType][i])
{
FamInfo[idx][fVeh][i] = CreateVehicle(FamInfo[idx][fVehType][i], FamInfo[idx][fVehCoX][i], FamInfo[idx][fVehCoY][i], FamInfo[idx][fVehCoZ][i], FamInfo[idx][fVehRot][i], FamInfo[idx][fVehCol1][i], FamInfo[idx][fVehCol2][i], 1200);
ChangeVehicleColor(FamInfo[idx][fVeh][i], FamInfo[idx][fVehCol1][i], FamInfo[idx][fVehCol2][i]);
Fam[FamInfo[idx][fVeh][i]] = idx;
}
}
idx++;
}
}
print("Families loaded successfully.");
return 1;
}