18.02.2016, 21:00
I get this idk what i am doing wrong
Код:
C:\Users\Nate\Desktop\test\gamemodes\test.pwn(6517 -- 6530) : warning 213: tag mismatch C:\Users\Nate\Desktop\test\gamemodes\test.pwn(6517 -- 6530) : error 032: array index out of bounds (variable "GarageInfo")
PHP код:
enum gInfo
{
gEnterX,
gEnterY,
gEnterZ,
gEnterAngle,
gExitX,
gExitY,
gExitZ,
gExitAngle,
gOwned,
gOwner,
gPrice,
gLocked,
gPickupID
};
new GarageInfo[SCRIPT_MAXGARGES][gInfo];
PHP код:
public SaveGarage()
{
new idx, File: file2, coordsstring[256];
while (idx < sizeof(GarageInfo))
{
format(coordsstring, sizeof(coordsstring), "%f|%f|%f|%f|%f|%f|%f|%f|%d|%s|%d|%d\n",
GarageInfo[idx][gEnterX],
GarageInfo[idx][gEnterY],
GarageInfo[idx][gEnterZ],
GarageInfo[idx][gEnterAngle],
GarageInfo[idx][gExitX],
GarageInfo[idx][gExitY],
GarageInfo[idx][gExitZ],
GarageInfo[idx][gExitAngle],
GarageInfo[idx][gOwned],
GarageInfo[idx][gOwner],
GarageInfo[idx][gPrice],
GarageInfo[idx][gLocked],
GarageInfo[idx][hPickupID]);
if(idx == 0) file2 = fopen("garage.ini", io_write);
else file2 = fopen("garage.ini", io_append);
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}
PHP код:
public LoadGarage()
{
printf("Loading Garages...");
new arrCoords[13][64], strFromFile2[256];
new File: file = fopen("garage.ini", io_read);
if (file)
{
new idx;
while (idx < sizeof(GarageInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
GarageInfo[idx][gEnterX] = floatstr(arrCoords[0]);
GarageInfo[idx][gEnterY] = floatstr(arrCoords[1]);
GarageInfo[idx][gEnterZ] = floatstr(arrCoords[2]);
GarageInfo[idx][gEnterAngle] = floatstr(arrCoords[3]);
GarageInfo[idx][gExitX] = floatstr(arrCoords[4]);
GarageInfo[idx][gExitY] = floatstr(arrCoords[5]);
GarageInfo[idx][gExitZ] = floatstr(arrCoords[6]);
GarageInfo[idx][gExitAngle] = floatstr(arrCoords[7]);
GarageInfo[idx][gOwned] = strval(arrCoords[8]);
strmid(GarageInfo[idx][gOwner], arrCoords[9], 0, strlen(arrCoords[9]), 255);
GarageInfo[idx][gPrice] = strval(arrCoords[10]);
GarageInfo[idx][gLocked] = strval(arrCoords[11]);
GarageInfo[idx][gPickupID] = strval(arrCoords[12]);
idx++;
}
}
fclose(file);
return 1;
}