09.08.2011, 09:44
Hi guys,
so I have this code when a player buys a car:
And I get undefined sysmbol idx, because idx isn't defined but I don't know how to define it with this code...
Please help.
so I have this code when a player buys a car:
pawn Код:
CarInfo[idx][vModel] = 560;
CarInfo[idx][vLocationx] = 559.5988;
CarInfo[idx][vLocationy] = -1267.7670;
CarInfo[idx][vLocationz] = 17.2422;
CarInfo[idx][vAngle] = 90.00;
CarInfo[idx][vColorOne] = 0;
CarInfo[idx][vColorTwo] = 0;
strmid(CarInfo[idx][vOwner], PlayerName(playerid), 0, strlen(PlayerName(playerid)), 255);
strmid(CarInfo[idx][vDescription], arrCoords[8], 0, strlen(arrCoords[8]), 255);
CarInfo[idx][vValue] = 20000;
CarInfo[idx][vLicense] = 1;
CarInfo[idx][vOwned] = 1;
CarInfo[idx][vLock] = 0;
pawn Код:
public LoadCar()
{
new arrCoords[13][64];
new strFromFile2[256];
new File: file = fopen("CarOwnership.cfg", io_read);
if (file)
{
new idx = 0;
while (idx < sizeof(CarInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
CarInfo[idx][vModel] = strval(arrCoords[0]);
CarInfo[idx][vLocationx] = floatstr(arrCoords[1]);
CarInfo[idx][vLocationy] = floatstr(arrCoords[2]);
CarInfo[idx][vLocationz] = floatstr(arrCoords[3]);
CarInfo[idx][vAngle] = floatstr(arrCoords[4]);
CarInfo[idx][vColorOne] = strval(arrCoords[5]);
CarInfo[idx][vColorTwo] = strval(arrCoords[6]);
strmid(CarInfo[idx][vOwner], arrCoords[7], 0, strlen(arrCoords[7]), 255);
strmid(CarInfo[idx][vDescription], arrCoords[8], 0, strlen(arrCoords[8]), 255);
CarInfo[idx][vValue] = strval(arrCoords[9]);
CarInfo[idx][vLicense] = strval(arrCoords[10]);
CarInfo[idx][vOwned] = strval(arrCoords[11]);
CarInfo[idx][vLock] = strval(arrCoords[12]);
printf("CarInfo: %d Owner:%s LicensePlate %s",idx,CarInfo[idx][vOwner],CarInfo[idx][vLicense]);
idx++;
}
}
return 1;
}