03.08.2011, 16:02
Need help, how can I move the system down to Dini or SII?
I tried a few times, but he was not the right way.
Thus it takes a lot to read and write.
Thx.
I tried a few times, but he was not the right way.
pawn Код:
forward MHouse();
public MHouse()
{
new arrCoords[21][64];
new strFromFile2[256];
new File: file = fopen("Houses.ini", io_read);
if(file)
{
new idx;
while (idx < sizeof(CasaInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, '|');
CasaInfo[idx][cFree] = strval(arrCoords[0]);
CasaInfo[idx][CX] = floatstr(arrCoords[1]);
CasaInfo[idx][CY] = floatstr(arrCoords[2]);
CasaInfo[idx][CZ] = floatstr(arrCoords[3]);
CasaInfo[idx][CR] = floatstr(arrCoords[4]);
CasaInfo[idx][XC] = floatstr(arrCoords[5]);
CasaInfo[idx][YC] = floatstr(arrCoords[6]);
CasaInfo[idx][ZC] = floatstr(arrCoords[7]);
strmid(CasaInfo[idx][cowner], arrCoords[8], 0, strlen(arrCoords[8]), 255);
CasaInfo[idx][cvalue] = strval(arrCoords[9]);
CasaInfo[idx][clocked] = strval(arrCoords[10]);
CasaInfo[idx][cGarage] = strval(arrCoords[11]);
CasaInfo[idx][GX] = floatstr(arrCoords[12]);
CasaInfo[idx][GY] = floatstr(arrCoords[13]);
CasaInfo[idx][GZ] = floatstr(arrCoords[14]);
CasaInfo[idx][cInt] = strval(arrCoords[15]);
CasaInfo[idx][cVIP] = strval(arrCoords[16]);
CasaInfo[idx][cWorld] = strval(arrCoords[17]);
CasaInfo[idx][cRent] = strval(arrCoords[18]);
CasaInfo[idx][cRental] = strval(arrCoords[19]);
CasaInfo[idx][cSafe] = strval(arrCoords[20]);
idx++;
}
fclose(file);
}
SalvarCasas();
return 1;
}
forward SHouse();
public SHouse()
{
new idx;
new File: file2;
while(idx < sizeof(CasaInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d|%f|%f|%f|%f|%f|%f|%f|%s|%d|%d|%d|%f|%f|%f|%d|%d|%d|%d|%d|%d\r\n",
CasaInfo[idx][cFree],
CasaInfo[idx][CX],
CasaInfo[idx][CY],
CasaInfo[idx][CZ],
CasaInfo[idx][CR],
CasaInfo[idx][XC],
CasaInfo[idx][YC],
CasaInfo[idx][ZC],
CasaInfo[idx][cowner],
CasaInfo[idx][cvalue],
CasaInfo[idx][clocked],
CasaInfo[idx][cGarage],
CasaInfo[idx][GX],
CasaInfo[idx][GY],
CasaInfo[idx][GZ],
CasaInfo[idx][cInt],
CasaInfo[idx][cVIP],
CasaInfo[idx][cWorld],
CasaInfo[idx][cRent],
CasaInfo[idx][cRental],
CasaInfo[idx][cSafe]);
if(idx == 0)
{
file2 = fopen("Houses.ini", io_write);
}
else
{
file2 = fopen("Houses.ini", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}
Thx.