File Functions Problem
#1

Hi Again!
I'm using modified GF and I have there some file functions problem.
Here it is:
I have problem with Vehicle Saving... When Vehicle Loads from file vehicle.cfg it looks like that:
Код:
598|2273.000000|2443.000000|9.000000|181.000000|2273.000000|2443.000000|9.000000|181.000000|-1|-1|60000|0|The State|None|LV999USA|0|0|1|0|25000|0|0|0|0|LV Police Car
598|2273.000000|2477.000000|9.000000|178.000000|2273.000000|2477.000000|9.000000|178.000000|-1|-1|60000|0|The State|None|LV999USA|0|0|1|0|25000|0|0|0|0|LV Police Car
Here is all ok.

But when vehicle are saving files looks like that:
Код:
598|2273.000000|2443.000000|9.000000|181.000000|2273.000000|2443.000000|9.000000|181.000000|-1|-1|60000|0|The State|None|LV999USA|0|0|1|0|25000|0|0|0|0|LV Police Car

598|2273.000000|2477.000000|9.000000|178.000000|2273.000000|2477.000000|9.000000|178.000000|-1|-1|60000|0|The State|None|LV999USA|0|0|1|0|25000|0|0|0|0|LV Police Car
Don't know what to do.... Here is my SaveCars()
Код:
public SaveCars()
{
	new idx;
	new File: file2;
	while (idx < sizeof(CarInfo))
	{
		new coordsstring[256];
		format(coordsstring, sizeof(coordsstring), "%d|%f|%f|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d|%s|%s|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%s\r\n", // I tried with \r and without... same thing...
		CarInfo[idx][cId],
		CarInfo[idx][cCar_x],
		CarInfo[idx][cCar_y],
		CarInfo[idx][cCar_z],
		CarInfo[idx][cCar_a],
		CarInfo[idx][cVeh_X],
		CarInfo[idx][cVeh_Y],
		CarInfo[idx][cVeh_Z],
		CarInfo[idx][cVeh_A],
		CarInfo[idx][cColor1],
		CarInfo[idx][cColor2],
		CarInfo[idx][cTime],
		CarInfo[idx][cOwned],
		CarInfo[idx][cOwner],
    CarInfo[idx][cROwner],
    CarInfo[idx][cNumplate],
    CarInfo[idx][cTeh],
    CarInfo[idx][cLocked],
    CarInfo[idx][cKey],
    CarInfo[idx][cRent],
    CarInfo[idx][cCost],
    CarInfo[idx][cLock],
    CarInfo[idx][cAlarm],
    CarInfo[idx][cImmob],
    CarInfo[idx][cInsurance],
    CarInfo[idx][cDesc]);
		if(idx == 1)
		{
			file2 = fopen("vehicle.cfg", io_write);
		}
		else
		{
			file2 = fopen("vehicle.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
	return 1;
}
In the script it looks normally...

So.. Who can help me?

Best Regrads, McSquizzy
Reply
#2

maybe your last string in the format (CarInfo[idx][cDesc]) already contain "\r\n", have you tried remove both
the "\n" is the one responsible for the new line.
Reply
#3

There wasn't \r or \n in last string, but I tried to remove and now is all ok. But it's little strange... Maybee that was because last string was text?

to ******:
Yes, they were same, but in second vehicles didn't spawned, don't know why...
Reply
#4

There wasn't \r or \n in last string, but I tried to remove and now is all ok. But it's little strange... Maybee that was because last string was text?

to ******:
Yes, they were same, but in second vehicles didn't spawned, don't know why...
Reply
#5

Quote:
Originally Posted by McSquizzy
There wasn't \r or \n in last string, but I tried to remove and now is all ok. But it's little strange... Maybee that was because last string was text?

to ******:
Yes, they were same, but in second vehicles didn't spawned, don't know why...
You totaly misunderstood what ****** said.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)