Convert
#1

How to covert dini
Код:
stock UpdateMyVehSystem(id)
{
	new GSi[256];
	new place[64];
 	if(!dini_Exists(SaveFile))
	{
		dini_Create(SaveFile);
	}
 	format(GSi,sizeof(GSi),
	"%d,%d,\
	%f,%f,%f,%f,\
	%d,%d,%d,\
	%s,\
	%d,\
	%d,%d,%d,%d,\
	%d",
	MyVehicle[id][MyVehSlot],MyVehicle[id][MyVehModel],
	MyVehicle[id][MyVehPos][0],MyVehicle[id][MyVehPos][1],MyVehicle[id][MyVehPos][2],MyVehicle[id][MyVehPos][3],
	MyVehicle[id][MyVehCol][0],MyVehicle[id][MyVehCol][1],MyVehicle[id][MyVehLock],
	MyVehicle[id][MyVehOwner], // string
	MyVehicle[id][MyVehAlarm],
	MyVehicle[id][MyVehCar],MyVehicle[id][MyVehBike],MyVehicle[id][MyVehBoat],MyVehicle[id][MyVehPlane],
	MyVehicle[id][MyVehFsale]);
	format(place,sizeof(place),"MyCar_%d",id);
    dini_Set(SaveFile,place,GSi);
    printf("ID %d SET",id);
    if(MyVehicle[id][MyVehSlot] == 0)
        {
                format(GSi,sizeof(GSi),
				"%d,%d,\
				%f,%f,%f,%f,\
				%d,%d,%d,\
				%s,\
				%d,\
				%d,%d,%d,%d,\
				%d",
				MyVehicle[id][MyVehSlot],MyVehicle[id][MyVehModel],
				MyVehicle[id][MyVehPos][0],MyVehicle[id][MyVehPos][1],MyVehicle[id][MyVehPos][2],MyVehicle[id][MyVehPos][3],
				MyVehicle[id][MyVehCol][0],MyVehicle[id][MyVehCol][1],MyVehicle[id][MyVehLock],
				MyVehicle[id][MyVehOwner], // string
				MyVehicle[id][MyVehAlarm],
				MyVehicle[id][MyVehCar],MyVehicle[id][MyVehBike],MyVehicle[id][MyVehBoat],MyVehicle[id][MyVehPlane],
				MyVehicle[id][MyVehFsale]);
				format(place,sizeof(place),"MyCar_%d",id);
            	dini_Unset(SaveFile ,place);
            	printf("ID %d UNSET",id);
        }
  return 1;
 }
and

Код:
stock LoadMyVehSystem()
{
	new reload[256];
	new loader[64];
	if(!dini_Exists(SaveFile))
	{
		dini_Create(SaveFile);
	}
	for(new i = 0;i<sizeof(MyVehicle);i++)
	{
    	format(loader,sizeof(loader),"MyCar_%d",i);
    	strmid(reload,dini_Get(SaveFile,loader),0,256,256);
		new data2[32]; //STRING
		sscanf(reload,
		"p<,>dd\
		ffff\
		ddd\
		s[64]\
		d\
		dddd\
		d",
		MyVehicle[i][MyVehSlot],MyVehicle[i][MyVehModel],
		MyVehicle[i][MyVehPos][0],MyVehicle[i][MyVehPos][1],MyVehicle[i][MyVehPos][2],MyVehicle[i][MyVehPos][3],
		MyVehicle[i][MyVehCol][0],MyVehicle[i][MyVehCol][1],MyVehicle[i][MyVehLock],
		data2, // string
		MyVehicle[i][MyVehAlarm],
		MyVehicle[i][MyVehCar],MyVehicle[i][MyVehBike],MyVehicle[i][MyVehBoat],MyVehicle[i][MyVehPlane],
		MyVehicle[i][MyVehFsale]);
		strmid(MyVehicle[i][MyVehOwner], data2, 0, strlen(data2), 64);// kraj loadanja
		
		if(MyVehicle[i][MyVehSlot] == 1 && (MyVehicle[i][MyVehCar] != -1 || MyVehicle[i][MyVehBike] != -1 || MyVehicle[i][MyVehBoat] != -1 || MyVehicle[i][MyVehPlane] != -1))
		{
			MyVehicle[i][MyVehID] = CreateVehicle(MyVehicle[i][MyVehModel],MyVehicle[i][MyVehPos][0],MyVehicle[i][MyVehPos][1],MyVehicle[i][MyVehPos][2],MyVehicle[i][MyVehPos][3],MyVehicle[i][MyVehCol][0],MyVehicle[i][MyVehCol][1],30000);
		}
	}
  return 1;
}
to YSI
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)