Stock for saving vehicle numbers via y_ini (%d.ini) -
Riwerry - 12.11.2013
Guys, please can somebody write me a stock, that I can use for saving .ini file (using Y_INI). I need to make it from vehicleids. For example first vehicle will be saved 1.ini, second 2.ini, etc, I guess so you understand me.. I'm just begginer and I can't create stock or something for it..
Re: Stock for saving vehicle numbers via y_ini (%d.ini) -
Ghazal - 12.11.2013
Код:
new SaveVehicleIndex;
public SaveTimer()
{
SaveVehicleIndex++;
if(SaveVehicleIndex >= MAX_DVEHICLES) SaveVehicleIndex = 1;
if(IsValidVehicle(SaveVehicleIndex)) SaveVehicle(SaveVehicleIndex);
}
Код:
SaveVehicle(vehicleid)
{
new filename[64], line[256];
format(filename, sizeof(filename), VEHICLE_FILE_PATH "v%d.ini", vehicleid);
new File:handle = fopen(filename, io_write);
format(line, sizeof(line), "Created=%d\r\n", VehicleCreated[vehicleid]); fwrite(handle, line);
format(line, sizeof(line), "Model=%d\r\n", VehicleModel[vehicleid]); fwrite(handle, line);
format(line, sizeof(line), "Pos=%.3f,%.3f,%.3f,%.3f\r\n", VehiclePos[vehicleid][0], VehiclePos[vehicleid][1],
VehiclePos[vehicleid][2], VehiclePos[vehicleid][3]);
fwrite(handle, line);
format(line, sizeof(line), "Colors=%d,%d\r\n", VehicleColor[vehicleid][0], VehicleColor[vehicleid][1]); fwrite(handle, line);
format(line, sizeof(line), "Interior=%d\r\n", VehicleInterior[vehicleid]); fwrite(handle, line);
format(line, sizeof(line), "VirtualWorld=%d\r\n", VehicleWorld[vehicleid]); fwrite(handle, line);
format(line, sizeof(line), "Owner=%s\r\n", VehicleOwner[vehicleid]); fwrite(handle, line);
format(line, sizeof(line), "NumberPlate=%s\r\n", VehicleNumberPlate[vehicleid]); fwrite(handle, line);
format(line, sizeof(line), "Value=%d\r\n", VehicleValue[vehicleid]); fwrite(handle, line);
format(line, sizeof(line), "Lock=%d\r\n", VehicleLock[vehicleid]); fwrite(handle, line);
format(line, sizeof(line), "Alarm=%d\r\n", VehicleAlarm[vehicleid]); fwrite(handle, line);
format(line, sizeof(line), "Paintjob=%d\r\n", VehiclePaintjob[vehicleid]); fwrite(handle, line);
for(new t=0; t < sizeof(VehicleTrunk[]); t++)
{
format(line, sizeof(line), "Trunk%d=%d,%d\r\n", t+1, VehicleTrunk[vehicleid][t][0], VehicleTrunk[vehicleid][t][1]);
fwrite(handle, line);
}
for(new m=0; m < sizeof(VehicleMods[]); m++)
{
format(line, sizeof(line), "Mod%d=%d\r\n", m, VehicleMods[vehicleid][m]);
fwrite(handle, line);
}
fclose(handle);
}
Re: Stock for saving vehicle numbers via y_ini (%d.ini) -
Riwerry - 12.11.2013
I just want to my Y_INI will create file 1.ini, then for example 2.ini by vehicleid when I save something in vehicle (but that saving thins doesnt matter I already have it, not worry about it)
I just need format for it..
Re: Stock for saving vehicle numbers via y_ini (%d.ini) -
Ghazal - 12.11.2013
I Dont Know Then, Goodluck
Re: Stock for saving vehicle numbers via y_ini (%d.ini) -
Riwerry - 12.11.2013
Some string that will use number for each vehicleid and format by %d so it will make from vehicles 1.ini 2.ini 3.ini etc, each one is one vehicleid, I don't know how to explain it