forward LoadCar_Data(name[], value[]);
public LoadCar_Data(name[], value[])
{
for(new idx = 1; idx < sizeof(CarInfo) ; idx++)
{
new carfile[64];
format(carfile, sizeof(carfile),"LARP/Vehicles/%d.ini", idx);
new INI:clfile = INI_Open(carfile);
if(fexist(carfile))
{
INI_Int("Model",CarInfo[idx][cModel]);
INI_Float("Location_X",CarInfo[idx][cLocationx]);
INI_Float("Location_Y",CarInfo[idx][cLocationy]);
INI_Float("Location_Z",CarInfo[idx][cLocationz]);
INI_Float("Angle",CarInfo[idx][cAngle]);
INI_Int("Color_1",CarInfo[idx][cColorOne]);
INI_Int("Color_2",CarInfo[idx][cColorTwo]);
INI_String("Owner",CarInfo[idx][cOwner], 24);
INI_Int("Owned",CarInfo[idx][cOwned]);
INI_Int("Locked",CarInfo[idx][cLock]);
INI_Int("VirtualWorld",CarInfo[idx][cVirWorld]);
INI_Int("Component0",CarInfo[idx][cComponent0]);
INI_Int("Component1",CarInfo[idx][cComponent1]);
INI_Int("Component2",CarInfo[idx][cComponent2]);
INI_Int("Component3",CarInfo[idx][cComponent3]);
INI_Int("Component4",CarInfo[idx][cComponent4]);
INI_Int("Component5",CarInfo[idx][cComponent5]);
INI_Int("Component6",CarInfo[idx][cComponent6]);
INI_Int("Component7",CarInfo[idx][cComponent7]);
INI_Int("Component8",CarInfo[idx][cComponent8]);
INI_Int("Component9",CarInfo[idx][cComponent9]);
INI_Int("Component10",CarInfo[idx][cComponent10]);
INI_Int("Component11",CarInfo[idx][cComponent11]);
INI_Int("Component12",CarInfo[idx][cComponent12]);
INI_Int("Component13",CarInfo[idx][cComponent13]);
INI_Int("SecurityCode",CarInfo[idx][cCode]);
INI_Close(clfile); // Closes the file
}
}
return 1;
}
public LoadCar()
{
for(new idx = 1; idx < sizeof(CarInfo) ; idx++)
{
new carfile[64];
format(carfile, sizeof(carfile),"LARP/Vehicles/%d.ini", idx);
new INI:clfile = INI_Open(carfile);
if(fexist(carfile))
{
INI_ParseFile("clfile", "LoadCar_Data", .bExtra = true, .extra = idx);
}
INI_Close(clfile); // Closes the file
}
print("[SCRIPT]: Loaded Cars");
return 1;
}
INI_ParseFile(carfile, "LoadCar_Data", .bExtra = true, .extra = idx);
public LoadCar()
{
for(new idx = 1; idx < sizeof(CarInfo) ; idx++)
{
new carfile[64];
format(carfile, sizeof(carfile),"LARP/Vehicles/%d.ini", idx);
new INI:clfile = INI_Open(carfile);
if(fexist(carfile))
{
INI_ParseFile("clfile", "LoadCar_Data", .bExtra = true, .extra = idx);
CreateVehicle(CarInfo[idx][cModel],CarInfo[idx][cLocationx],CarInfo[idx][cLocationy], CarInfo[idx][cLocationz], CarInfo[idx][cAngle], CarInfo[idx][cColorOne],CarInfo[idx][cColorOne],5000);
}
INI_Close(clfile); // Closes the file
}
print("[SCRIPT]: Loaded Cars");
return 1;
}
public OnGameModeInit() // Do not add vehicles Above the next lines. - CuervO
{
LoadCar();
new string2[64];
for(new h = 0; h < sizeof(CarInfo); h++)
{
format(string2, sizeof(string2), "LARP/Vehicles/%d.ini",h);
new INI:gmcfile = INI_Open(string2);
if(fexist(string2))
{
ownedcar[h] = AddStaticVehicleEx(CarInfo[h][cModel],CarInfo[h][cLocationx],CarInfo[h][cLocationy],CarInfo[h][cLocationz]+1.0,CarInfo[h][cAngle],CarInfo[h][cColorOne],CarInfo[h][cColorTwo],60000);
if(CarInfo[h][cLock] == 1)
{
new e,l,a,d,b,bo,o;
GetVehicleParamsEx(h,e,l,a,d,b,bo,o);
SetVehicleParamsEx(h,e,l,a,1,b,bo,o);
}
if(CarInfo[h][cPaintjob] != 999)
{
ChangeVehiclePaintjob(h, CarInfo[h][cPaintjob]);
}
SetVehicleModifications(h);
new lights, alarm, doors, bonnet, boot, objective;
SetVehicleParamsEx(h, 0, lights, alarm, doors, bonnet, boot, objective);
engineOn[h] = false;
}
INI_Close(gmcfile); // Closes the file
}
INI_ParseFile(carfile, "LoadCar_Data", .bExtra = true, .extra = idx);
LoadCar();
new string2[64];
for(new h = 0; h < MAX_VEHICLES; h++)
{
format(string2, sizeof(string2), "LARP/Vehicles/%d.ini",h);
new INI:gmcfile = INI_Open(string2);
if(fexist(string2))
{
ownedcar[h] = AddStaticVehicleEx(CarInfo[h][cModel],CarInfo[h][cLocationx],CarInfo[h][cLocationy],CarInfo[h][cLocationz]+1.0,CarInfo[h][cAngle],CarInfo[h][cColorOne],CarInfo[h][cColorTwo],60000);
if(CarInfo[h][cLock] == 1)
{
new e,l,a,d,b,bo,o;
GetVehicleParamsEx(h,e,l,a,d,b,bo,o);
SetVehicleParamsEx(h,e,l,a,1,b,bo,o);
}
if(CarInfo[h][cPaintjob] != 999)
{
ChangeVehiclePaintjob(h, CarInfo[h][cPaintjob]);
}
SetVehicleModifications(h);
new lights, alarm, doors, bonnet, boot, objective;
SetVehicleParamsEx(h, 0, lights, alarm, doors, bonnet, boot, objective);
engineOn[h] = false;
}
INI_Close(gmcfile); // Closes the file
}
What about this?
pawn Код:
|