My code that launches many times even if the file does not exist, and load the stats of the first vehicle , and then positions will not load, then loading a Boolean do crash all the code . (****** translate)
Код:
public OnFilterScriptInit()
{
new stringFile[56];
for(new i = 0; i < MAX_VEHICLES; i++)
{
format(stringFile, sizeof(stringFile), "/vehicles/%i.ini", i);
if(fexist(stringFile)) INI_ParseFile(stringFile, "LoadVehicleData", .bExtra = true, .extra = i);
}
printf("[VEHICULE]: Un total de %d vйhicule(s) sont chargй", nbVeh);
return 1;
}
forward LoadVehicleData(id, name[],value[]);
public LoadVehicleData(id, name[],value[])
{
INI_Int("Model", vehicleInfo[id][v_Model]);
INI_Int("Color1", vehicleInfo[id][v_Color][0]);
INI_Int("Color2", vehicleInfo[id][v_Color][1]);
INI_Int("Fuel", vehicleInfo[id][v_Fuel]);
INI_Int("Price", vehicleInfo[id][v_Price]);
INI_Int("Interior", vehicleInfo[id][v_Interior]);
INI_Int("VW", vehicleInfo[id][v_VW]);
INI_Bool("Lock", vehicleInfo[id][v_Lock]);
INI_Bool("FuelOn", vehicleInfo[id][v_FuelOn]);
INI_Bool("LockOn", vehicleInfo[id][v_LockOn]);
INI_Bool("BuyOn", vehicleInfo[id][v_BuyOn]);
INI_String("Owend", vehicleInfo[id][v_Owend], MAX_PLAYER_NAME);
INI_Float("PosX", vehicleInfo[id][v_Pos][0]);
INI_Float("PosY", vehicleInfo[id][v_Pos][1]);
INI_Float("PosZ", vehicleInfo[id][v_Pos][2]);
INI_Float("PosA", vehicleInfo[id][v_Pos][3]);
printf("PosX: %f", vehicleInfo[id][v_Pos][0]);
vehicleInfo[id][v_ID] = CreateVehicle(vehicleInfo[id][v_Model], vehicleInfo[id][v_Pos][0], vehicleInfo[id][v_Pos][1], vehicleInfo[id][v_Pos][2], vehicleInfo[id][v_Pos][3], vehicleInfo[id][v_Color][0], vehicleInfo[id][v_Color][1], -1);
nbVeh++;
return 1;
}