24.01.2015, 09:13
I have a car system and that should save the cars location when the script closes and it does save. Although upon opening the script It doesnt load at the correct coordinates. The cars load at 0,0,0.
*Here is the Load Vehicle stock."
*Here is the Main*
*Here is the Load Vehicle stock."
pawn Код:
stock LoadVehicles()
{
new string[80], file[64], engine, lights, alarm, doors, bonnet, boot, objective, corrCount;
print("=-=-=-=-=-=-=-=-=-=-=-=-=");
print("\n Loading Vehicles: \n");
for(new v; v < MAX_VEHICLES; v ++)
{
GetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, boot, objective);
format(file, sizeof(file), "Vehicles/%d.ini", v);
if(fexist(file))
{
INI_ParseFile(VehiclePath(v), "LoadVehicleData", false, true, v, true, false);
format(string, sizeof(string), "SA %d", vInfo[v][Plate]);
SetVehicleNumberPlate(v, string);
SetVehicleToRespawn(v); // respawning so the license plate shows
SetVehicleParamsEx(v, 0, lights, alarm, 1, bonnet, boot, objective);
vEngine[v] = false;
vLocked[v] = true;
format(string, sizeof(string), " Loaded vehicle ID: %d at %f %f %f", v, vInfo[v][xPos], vInfo[v][yPos], vInfo[v][zPos]);
CreateVehicle(vInfo[v][Model], vInfo[v][xPos], vInfo[v][yPos], vInfo[v][zPos], vInfo[v][aPos], vInfo[v][ColorA], vInfo[v][ColorB], -1);
print(string);
vCount ++;
}
}
// Since vCount requires ID 1 to function properly, we don't actually load "1" vehicle.
corrCount = vCount - 1; // This fixes the +1 bug and shouldn't be removed.
printf("\n %d vehicles loaded!", corrCount);
print("=-=-=-=-=-=-=-=-=-=-=-=-=");
return true;
}
pawn Код:
main()
{
print("\n=-=-=-=-=-=-=-=-=-=-=-=-=");
print("=-= Loading systems =-=");
print("=-=-=-=-=-=-=-=-=-=-=-=-=\n");
LoadVehicles();
print("\n=-=-=-=-=-=-=-=-=-=-=-=-=");
print("=-= Loading finished! =-=");
print("=-=-=-=-=-=-=-=-=-=-=-=-=\n");
}