stock LoadCars()
{
new vinfo[12][32];
new string[256];
new File:file = fopen("cars.cfg", io_read);
if(file)
{
new idx = 1;
while(idx < MAX_CARS)
{
fread(file, string);
splits(string, vinfo, '|');
VehicleInfo[idx][vModel] = strval(vinfo[0]);
VehicleInfo[idx][vX] = floatstr(vinfo[1]);
VehicleInfo[idx][vY] = floatstr(vinfo[2]);
VehicleInfo[idx][vZ] = floatstr(vinfo[3]);
VehicleInfo[idx][vAngle] = floatstr(vinfo[4]);
VehicleInfo[idx][vColor1] = strval(vinfo[5]);
VehicleInfo[idx][vColor2] = strval(vinfo[6]);
CreateVehicle(strval(vinfo[0]), floatstr(vinfo[1]), floatstr(vinfo[2]), floatstr(vinfo[3]), floatstr(vinfo[4]), strval(vinfo[5]), strval(vinfo[6]), -1);
//CreateVehicle(VehicleInfo[idx][vModel], VehicleInfo[idx][vX], VehicleInfo[idx][vY], VehicleInfo[idx][vZ], VehicleInfo[idx][vAngle], VehicleInfo[idx][vColor1], VehicleInfo[idx][vColor2], -1);
//CreateVehicle(Vehiclenfop, Float:vX, Float:vY, Float:vZ, Float:vAngle, vColor1, vColor2, -1);
//print("Loaded?");
idx++;
}
}
//idx++;
print("Universal Gaming: Vehicles are susscefully loaded!");
return 1;
}
//print("Loaded?");
Loaded? Loaded? Loaded? Loaded? Universal Gaming: Vehicles are susscefully loaded!
stock LoadCars()
{
new idx;
new vinfo[12][32];
new string[256];
new File:file = fopen("cars.cfg", io_read);
if(file)
{
fread(file, string);
while(splits(string, vinfo, '|') && idx < MAX_CARS)
{
VehicleInfo[idx][vModel] = strval(vinfo[0]);
VehicleInfo[idx][vX] = floatstr(vinfo[1]);
VehicleInfo[idx][vY] = floatstr(vinfo[2]);
VehicleInfo[idx][vZ] = floatstr(vinfo[3]);
VehicleInfo[idx][vAngle] = floatstr(vinfo[4]);
VehicleInfo[idx][vColor1] = strval(vinfo[5]);
VehicleInfo[idx][vColor2] = strval(vinfo[6]);
CreateVehicle(strval(vinfo[0]), floatstr(vinfo[1]), floatstr(vinfo[2]), floatstr(vinfo[3]), floatstr(vinfo[4]), strval(vinfo[5]), strval(vinfo[6]), -1);
//CreateVehicle(VehicleInfo[idx][vModel], VehicleInfo[idx][vX], VehicleInfo[idx][vY], VehicleInfo[idx][vZ], VehicleInfo[idx][vAngle], VehicleInfo[idx][vColor1], VehicleInfo[idx][vColor2], -1);
//CreateVehicle(Vehiclenfop, Float:vX, Float:vY, Float:vZ, Float:vAngle, vColor1, vColor2, -1);
//print("Loaded?");
idx++;
}
}
//idx++;
print("Universal Gaming: Vehicles are susscefully loaded!");
return 1;
}
shouldnt it be while(fread(file, string)) ?
also close the file fclose(file); after it done with reading |
stock LoadCars()
{
new idx;
new vinfo[12][32];
new string[256];
new File:file = fopen("cars.cfg", io_read);
if(file)
{
while(fread(file, string) && idx < MAX_CARS)
{
splits(string, vinfo, '|');
VehicleInfo[idx][vModel] = strval(vinfo[0]);
VehicleInfo[idx][vX] = floatstr(vinfo[1]);
VehicleInfo[idx][vY] = floatstr(vinfo[2]);
VehicleInfo[idx][vZ] = floatstr(vinfo[3]);
VehicleInfo[idx][vAngle] = floatstr(vinfo[4]);
VehicleInfo[idx][vColor1] = strval(vinfo[5]);
VehicleInfo[idx][vColor2] = strval(vinfo[6]);
CreateVehicle(strval(vinfo[0]), floatstr(vinfo[1]), floatstr(vinfo[2]), floatstr(vinfo[3]), floatstr(vinfo[4]), strval(vinfo[5]), strval(vinfo[6]), -1);
//CreateVehicle(VehicleInfo[idx][vModel], VehicleInfo[idx][vX], VehicleInfo[idx][vY], VehicleInfo[idx][vZ], VehicleInfo[idx][vAngle], VehicleInfo[idx][vColor1], VehicleInfo[idx][vColor2], -1);
//CreateVehicle(Vehiclenfop, Float:vX, Float:vY, Float:vZ, Float:vAngle, vColor1, vColor2, -1);
//print("Loaded?");
idx++;
}
}
//idx++;
print("Universal Gaming: Vehicles are susscefully loaded!");
return 1;
}