I spawn cars,save them,but in restart they dont load.
Код:
stock InitVehicles()
{
new Vehicle[16];
for(new i = 0; i < MAX_VEHICLES; i++)
{
format(Vehicle, sizeof(Vehicle), "V_%d", i);
if(djIsSet(VEHICLES_FILE, Vehicle))
{
format(Vehicle, sizeof(Vehicle), "V_%d/PosX", i);
Vehicles[i][CarPosX] = djFloat(VEHICLES_FILE, Vehicle, true);
format(Vehicle, sizeof(Vehicle), "V_%d/PosY", i);
Vehicles[i][CarPosY] = djFloat(VEHICLES_FILE, Vehicle, true);
format(Vehicle, sizeof(Vehicle), "V_%d/PosZ", i);
Vehicles[i][CarPosZ] = djFloat(VEHICLES_FILE, Vehicle, true);
format(Vehicle, sizeof(Vehicle), "V_%d/ZAngle", i);
Vehicles[i][CarZAngle] = djFloat(VEHICLES_FILE, Vehicle, true);
format(Vehicle, sizeof(Vehicle), "V_%d/Model", i);
Vehicles[i][CarModel] = djInt(VEHICLES_FILE, Vehicle, true);
format(Vehicle, sizeof(Vehicle), "V_%d/Col1", i);
Vehicles[i][CarColour1] = djInt(VEHICLES_FILE, Vehicle, true);
format(Vehicle, sizeof(Vehicle), "V_%d/Col2", i);
Vehicles[i][CarColour2] = djInt(VEHICLES_FILE, Vehicle, true);
format(Vehicle, sizeof(Vehicle), "V_%d/Group", i);
Vehicles[i][CarGroup] = djInt(VEHICLES_FILE, Vehicle, true);
CarCount++;
if(Vehicles[i][CarModel] != 537 && Vehicles[i][CarModel] != 538 && Vehicles[i][CarModel] != 569 && 570 && Vehicles[i][CarModel] != 590)
{
Vehicles[i][GameID] = AddStaticVehicleEx(Vehicles[i][CarModel], Vehicles[i][CarPosX], Vehicles[i][CarPosY], Vehicles[i][CarPosZ], Vehicles[i][CarZAngle], Vehicles[i][CarColour1], Vehicles[i][CarColour2], 3600);
}
printf("[system] InitVehicles(): Vehicle %d has spawned (spawned from %s).", i, VEHICLES_FILE);
}
}
}
stock IsNumeric(string[]) { for (new i = 0, j = strlen(string); i < j; i++) if (string[i] > '9' || string[i] < '0') return 0; return 1; }
I think its missing something at the code,but my low scripting skills doesnt allow me to fix it xD