hier mal wie ich den speicher/lade code machen würde:
public LoadFrakCars()
{
for(new f=0;f<sizeof(frakcarmodel);f++)
{
new arrCoords[9][64];
new strFromFile2[256];
new str[60];
format(str,sizeof(str),"frakcars/frak%d.cfg",f);
new File: file = fopen(str, io_read);
if (file)
{
new idx;
while (fread(file, strFromFile2))
{
if(idx>sizeof(frakcarmodel[])) break;
split(strFromFile2, arrCoords, ',');
frakcarmodel[f][idx] = strval(arrCoords[0]);
frakcarcolor1[f][idx] = strval(arrCoords[1]);
frakcarcolor2[f][idx] = strval(arrCoords[2]);
frakcarposx[f][idx] = floatstr(arrCoords[3]);
frakcarposy[f][idx] = floatstr(arrCoords[4]);
frakcarposz[f][idx] = floatstr(arrCoords[5]);
frakcarrot[f][idx] = floatstr(arrCoords[6]);
frakcarnitro[f][idx] = strval(arrCoords[7]);
frakcarhydr[f][idx] = strval(arrCoords[8]);
idx++;
}
fclose(file);
}
}
return 1;
}
public SaveFrakCars()
{
for(new f=0;f<sizeof(frakcarmodel);f++)
{
new idx;
new File: file2;
new str[60];
format(str,sizeof(str),"frakcars/frak%d.cfg",f);
file2 = fopen(str, io_write);
while (idx <sizeof(frakcarmodel[]))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d,%d,%d,%f,%f,%f,%f,5d,%d\n",
frakcarmodel[f][idx],
frakcarcolor1[f][idx],
frakcarcolor2[f][idx],
frakcarposx[f][idx],
frakcarposy[f][idx],
frakcarposz[f][idx],
frakcarrot[f][idx],
frakcarnitro[f][idx],
frakcarhydr[f][idx]);
fwrite(file2, coordsstring);
idx++;
}
fclose(file2);
}
}
wurde alles aus dem Kopfgeschrieben und nicht überprüft.