14.02.2013, 14:39
Код:
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; }