Hey Leute,
Habe hier ein Problem:
Ich habe in einer Funktion gehabt, dass Daten (Ints) in einer Zeile in einer .ini gespeichert & ausgelesen werden.
Jetzt wollte ich mehrere Zeilen machen, aber das auslesen ist nicht darauf bestimmt.
Könnte mir das einer zeigen ?
Hier der Code:
Function LoadFrakWaffen()
{
new arrCoords[122][122];
new strFromFile2[1000];
new File: file = fopen("/WTs/FrakMats.ini", io_read);
if (file)
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
ArmySDP = strval(arrCoords[0]);
ArmyD = strval(arrCoords[1]);
ArmyS = strval(arrCoords[2]);
ArmyU = strval(arrCoords[3]);
ArmyT = strval(arrCoords[4]);
ArmyMP = strval(arrCoords[5]);
ArmyAK = strval(arrCoords[6]);
ArmyM4 = strval(arrCoords[7]);
ArmySR = strval(arrCoords[8]);
ArmyRPG = strval(arrCoords[9]);
ArmyW = strval(arrCoords[10]);
LCNSDP = strval(arrCoords[11]);
LCND = strval(arrCoords[12]);
LCNS = strval(arrCoords[13]);
LCNU = strval(arrCoords[14]);
LCNT = strval(arrCoords[15]);
LCNMP = strval(arrCoords[16]);
LCNAK = strval(arrCoords[17]);
LCNM4 = strval(arrCoords[18]);
LCNSR = strval(arrCoords[19]);
LCNRPG = strval(arrCoords[20]);
LCNW = strval(arrCoords[21]);
YakSDP = strval(arrCoords[22]);
YakD = strval(arrCoords[23]);
YakS = strval(arrCoords[24]);
YakU = strval(arrCoords[25]);
YakT = strval(arrCoords[26]);
YakMP = strval(arrCoords[27]);
YakAK = strval(arrCoords[28]);
YakM4 = strval(arrCoords[29]);
YakSR = strval(arrCoords[30]);
YakRPG = strval(arrCoords[31]);
YakW = strval(arrCoords[32]);
HitSDP = strval(arrCoords[33]);
HitD = strval(arrCoords[34]);
HitS = strval(arrCoords[35]);
HitU = strval(arrCoords[36]);
HitT = strval(arrCoords[37]);
HitMP = strval(arrCoords[38]);
HitAK = strval(arrCoords[39]);
HitM4 = strval(arrCoords[40]);
HitSR = strval(arrCoords[41]);
HitRPG = strval(arrCoords[42]);
HitW = strval(arrCoords[43]);
TriaSDP = strval(arrCoords[44]);
TriaD = strval(arrCoords[45]);
TriaS = strval(arrCoords[46]);
TriaU = strval(arrCoords[47]);
TriaT = strval(arrCoords[48]);
TriaMP = strval(arrCoords[49]);
TriaAK = strval(arrCoords[50]);
TriaM4 = strval(arrCoords[51]);
TriaSR = strval(arrCoords[52]);
TriaRPG = strval(arrCoords[53]);
TriaW = strval(arrCoords[54]);
GrovSDP = strval(arrCoords[55]);
GrovD = strval(arrCoords[56]);
GrovS = strval(arrCoords[57]);
GrovU = strval(arrCoords[58]);
GrovT = strval(arrCoords[59]);
GrovMP = strval(arrCoords[60]);
GrovAK = strval(arrCoords[61]);
GrovM4 = strval(arrCoords[62]);
GrovSR = strval(arrCoords[63]);
GrovRPG = strval(arrCoords[64]);
GrovW = strval(arrCoords[65]);
BlsSDP = strval(arrCoords[66]);
BlsD = strval(arrCoords[67]);
BlsS = strval(arrCoords[68]);
BlsU = strval(arrCoords[69]);
BlsT = strval(arrCoords[70]);
BlsMP = strval(arrCoords[71]);
BlsAK = strval(arrCoords[72]);
BlsM4 = strval(arrCoords[73]);
BlsSR = strval(arrCoords[74]);
BlsRPG = strval(arrCoords[75]);
BlsW = strval(arrCoords[76]);
VgsSDP = strval(arrCoords[77]);
VgsD = strval(arrCoords[78]);
VgsS = strval(arrCoords[79]);
VgsU = strval(arrCoords[80]);
VgsT = strval(arrCoords[81]);
VgsMP = strval(arrCoords[82]);
VgsAK = strval(arrCoords[83]);
VgsM4 = strval(arrCoords[84]);
VgsSR = strval(arrCoords[85]);
VgsRPG = strval(arrCoords[86]);
VgsW = strval(arrCoords[87]);
RSSDP = strval(arrCoords[88]);
RSD = strval(arrCoords[89]);
RSS = strval(arrCoords[90]);
RSU = strval(arrCoords[91]);
RST = strval(arrCoords[92]);
RSMP = strval(arrCoords[93]);
RSAK = strval(arrCoords[94]);
RSM4 = strval(arrCoords[95]);
RSSR = strval(arrCoords[96]);
RSRPG = strval(arrCoords[97]);
RSW = strval(arrCoords[98]);
TerSDP = strval(arrCoords[99]);
TerD = strval(arrCoords[100]);
TerS = strval(arrCoords[101]);
TerU = strval(arrCoords[102]);
TerT = strval(arrCoords[103]);
TerMP = strval(arrCoords[104]);
TerAK = strval(arrCoords[105]);
TerM4 = strval(arrCoords[106]);
TerSR = strval(arrCoords[107]);
TerRPG = strval(arrCoords[108]);
TerW = strval(arrCoords[109]);
RMSDP = strval(arrCoords[110]);
RMD = strval(arrCoords[111]);
RMS = strval(arrCoords[112]);
RMU = strval(arrCoords[113]);
RMT = strval(arrCoords[114]);
RMMP = strval(arrCoords[115]);
RMAK = strval(arrCoords[116]);
RMM4 = strval(arrCoords[117]);
RMSR = strval(arrCoords[118]);
RMRPG = strval(arrCoords[119]);
RMW = strval(arrCoords[120]);
fclose(file);
}
else
{
printf("FRAKMATS.INI FEHLT");
}
return 1;
}
Function SaveFrakWaffen()
{
new coordsstring3[1000];
new coordsstring5[1000];
new coordsstring6[1000];
new coordsstring8[1000];
new coordsstring12[1000];
new coordsstring13[1000];
new coordsstring14[1000];
new coordsstring16[1000];
new coordsstring19[1000];
new coordsstring20[1000];
new coordsstring23[1000];
format(coordsstring3, sizeof(coordsstring3), "3,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",ArmySDP,ArmyD,ArmyS,ArmyU,ArmyT,ArmyMP,ArmyAK,ArmyM4,ArmySR,ArmyRPG,ArmyW);
format(coordsstring5, sizeof(coordsstring5), "5,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",LCNSDP,LCND,LCNS,LCNU,LCNT,LCNMP,LCNAK,LCNM4,LCNSR,LCNRPG,LCNW);
format(coordsstring6, sizeof(coordsstring6), "6,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",YakSDP,YakD,YakS,YakU,YakT,YakMP,YakAK,YakM4,YakSR,YakRPG,YakW);
format(coordsstring8, sizeof(coordsstring8), "8,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",HitSDP,HitD,HitS,HitU,HitT,HitMP,HitAK,HitM4,HitSR,HitRPG,HitW);
format(coordsstring12, sizeof(coordsstring12), "12,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",TriaSDP,TriaD,TriaS,TriaU,TriaT,TriaMP,TriaAK,TriaM4,TriaSR,TriaRPG,TriaW);
format(coordsstring13, sizeof(coordsstring13), "13,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",GrovSDP,GrovD,GrovS,GrovU,GrovT,GrovMP,GrovAK,GrovM4,GrovSR,GrovRPG,GrovW);
format(coordsstring14, sizeof(coordsstring14), "14,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",BlsSDP,BlsD,BlsS,BlsU,BlsT,BlsMP,BlsAK,BlsM4,BlsSR,BlsRPG,BlsW);
format(coordsstring16, sizeof(coordsstring16), "16,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",VgsSDP,VgsD,VgsS,VgsU,VgsT,VgsMP,VgsAK,VgsM4,VgsSR,VgsRPG,VgsW);
format(coordsstring19, sizeof(coordsstring19), "19,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",RSSDP,RSD,RSS,RSU,RST,RSMP,RSAK,RSM4,RSSR,RSRPG,RSW);
format(coordsstring20, sizeof(coordsstring20), "20,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",TerSDP,TerD,TerS,TerU,TerT,TerMP,TerAK,TerM4,TerSR,TerRPG,TerW);
format(coordsstring23, sizeof(coordsstring23), "23,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",RMSDP,RMD,RMS,RMU,RMT,RMMP,RMAK,RMM4,RMSR,RMRPG,RMW);
new File: file2 = fopen("/WTs/FrakMats.ini", io_write);
fwrite(file2, coordsstring3);
fwrite(file2, coordsstring5);
fwrite(file2, coordsstring6);
fwrite(file2, coordsstring8);
fwrite(file2, coordsstring12);
fwrite(file2, coordsstring13);
fwrite(file2, coordsstring14);
fwrite(file2, coordsstring16);
fwrite(file2, coordsstring19);
fwrite(file2, coordsstring20);
fwrite(file2, coordsstring23);
fclose(file2);
return 1;
}
Das speichern geht wunderbar, aber das auslesen nicht.
Bitte um Hilfe
MfG
Me