scripts that create problems
#1

I have a big problem
I put sheep Decaurand issue on personal cars
And had to add the following: "enum cInfo" and "public LoadCar()"
And intampalt like this, enter the SRV went that went! But when I gave the SRV RR or go out and meet as
Adika only breaks were all personal cars, all cars.cfg breaks. why, how can those below to be all right?
We added cInfo

Код:
cPlate[255],
	cPrice,
	cDestroyed,
	cInsurancecar,
	cInscarprice,
	cAudio,
now look like this
Код:
enum cInfo
{
	cModel,
	Float:cLocationx,
	Float:cLocationy,
	Float:cLocationz,
	Float:cAngle,
	cColor1,
	cColor2,
	cOwner[MAX_PLAYER_NAME],
	cDescription[MAX_PLAYER_NAME],
	cValue,
	cLicense[256],
	cRegistration,
	cOwned,
	cLock,
	cPlate[255],
	cPrice,
	cDestroyed,
	cInsurancecar,
	cInscarprice,
	cAudio,
};
and before they look like without
Код:
enum cInfo
{
	cModel,
	Float:cLocationx,
	Float:cLocationy,
	Float:cLocationz,
	Float:cAngle,
	cColorOne,
	cColorTwo,
	cOwner[MAX_PLAYER_NAME],
	cDescription[MAX_PLAYER_NAME],
	cValue,
	cLicense[256],
	cRegistration,
	cOwned,
	cLock,
};
_______________________________

After I added LoadCar
Код:
			CarInfo[idx][cDestroyed] = strval(arrCoords[13]);
			CarInfo[idx][cInsurancecar] = strval(arrCoords[14]);
			CarInfo[idx][cInscarprice] = strval(arrCoords[16]);
			CarInfo[idx][cAudio] = strval(arrCoords[18]);
			CarInfo[idx][cPrice] = strval(arrCoords[19]);
And now it is so
Код:
public LoadCar()
{
	new arrCoords[20][64];
	new strFromFile2[256];
	new File: file = fopen("cars.cfg", io_read);
	if (file)
	{
		new idx = 184;
		while (idx < sizeof(CarInfo))
		{
			fread(file, strFromFile2);
			split(strFromFile2, arrCoords, ',');
			CarInfo[idx][cModel] = strval(arrCoords[0]);
			CarInfo[idx][cLocationx] = floatstr(arrCoords[1]);
			CarInfo[idx][cLocationy] = floatstr(arrCoords[2]);
			CarInfo[idx][cLocationz] = floatstr(arrCoords[3]);
			CarInfo[idx][cAngle] = floatstr(arrCoords[4]);
			CarInfo[idx][cColor1] = strval(arrCoords[5]);
			CarInfo[idx][cColor2] = strval(arrCoords[6]);
			strmid(CarInfo[idx][cOwner], arrCoords[7], 0, strlen(arrCoords[7]), 255);
			strmid(CarInfo[idx][cDescription], arrCoords[8], 0, strlen(arrCoords[8]), 255);
			CarInfo[idx][cValue] = strval(arrCoords[9]);
			strmid(CarInfo[idx][cLicense], arrCoords[10], 0, strlen(arrCoords[10]), 256);
			//strmid(CarInfo[idx][cLicense], arrCoords[10], 0, strlen(arrCoords[10]), 255);
			CarInfo[idx][cOwned] = strval(arrCoords[11]);
			CarInfo[idx][cLock] = strval(arrCoords[12]);
			CarInfo[idx][cDestroyed] = strval(arrCoords[13]);
			CarInfo[idx][cInsurancecar] = strval(arrCoords[14]);
			CarInfo[idx][cInscarprice] = strval(arrCoords[16]);
			CarInfo[idx][cAudio] = strval(arrCoords[18]);
			CarInfo[idx][cPrice] = strval(arrCoords[19]);
			printf("CarInfo:%d Owner:%s Model: %s",idx,CarInfo[idx][cOwner],CarInfo[idx][cModel]);
			idx++;
		}
	}
	return 1;
}
Next look like
Код:
public LoadCar()
{
	new arrCoords[13][64];
	new strFromFile2[256];
	new File: file = fopen("cars.cfg", io_read);
	if (file)
	{
		new idx = 184;
		while (idx < sizeof(CarInfo))
		{
			fread(file, strFromFile2);
			split(strFromFile2, arrCoords, ',');
			CarInfo[idx][cModel] = strval(arrCoords[0]);
			CarInfo[idx][cLocationx] = floatstr(arrCoords[1]);
			CarInfo[idx][cLocationy] = floatstr(arrCoords[2]);
			CarInfo[idx][cLocationz] = floatstr(arrCoords[3]);
			CarInfo[idx][cAngle] = floatstr(arrCoords[4]);
			CarInfo[idx][cColorOne] = strval(arrCoords[5]);
			CarInfo[idx][cColorTwo] = strval(arrCoords[6]);
			strmid(CarInfo[idx][cOwner], arrCoords[7], 0, strlen(arrCoords[7]), 255);
			strmid(CarInfo[idx][cDescription], arrCoords[8], 0, strlen(arrCoords[8]), 255);
			CarInfo[idx][cValue] = strval(arrCoords[9]);
			strmid(CarInfo[idx][cLicense], arrCoords[10], 0, strlen(arrCoords[10]), 256);
			//strmid(CarInfo[idx][cLicense], arrCoords[10], 0, strlen(arrCoords[10]), 255);
			CarInfo[idx][cOwned] = strval(arrCoords[11]);
			CarInfo[idx][cLock] = strval(arrCoords[12]);
			printf("CarInfo: %d Owner:%s LicensePlate %s",idx,CarInfo[idx][cOwner],CarInfo[idx][cLicense]);
			idx++;
		}
	}
	return 1;
}
_____________
After I added SaveCarCoords()
Код:
public SaveCarCoords()
{
	new idx = 184;
	new File: file2;
	while (idx < sizeof(CarInfo))
	{
	    new coordsstring[256];
	    format(coordsstring, sizeof(coordsstring), "%d|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d\n",
		CarInfo[idx][cModel],
		CarInfo[idx][cLocationx],
		CarInfo[idx][cLocationy],
		CarInfo[idx][cLocationz],
		CarInfo[idx][cAngle],
		CarInfo[idx][cColor1],
		CarInfo[idx][cColor2],
		CarInfo[idx][cDestroyed],
		CarInfo[idx][cInsurancecar],
		CarInfo[idx][cInscarprice],
		CarInfo[idx][cAudio],
		CarInfo[idx][cLicense]);
		if(idx == 0)
		{
			file2 = fopen("cars.cfg", io_write);
		}
		else
		{
			file2 = fopen("cars.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
	return 1;
}
I added this
Код:
		CarInfo[idx][cInsurancecar],
		CarInfo[idx][cInscarprice],
		CarInfo[idx][cAudio],
		CarInfo[idx][cLicense]);
Inainte era asa
Код:
public SaveCarCoords()
{
	new idx = 184;
	new File: file2;
	while (idx < sizeof(CarInfo))
	{
	    new coordsstring[256];
	    format(coordsstring, sizeof(coordsstring), "%d|%f|%f|%f|%f|%d|%d|%s\n",
		CarInfo[idx][cModel],
		CarInfo[idx][cLocationx],
		CarInfo[idx][cLocationy],
		CarInfo[idx][cLocationz],
		CarInfo[idx][cAngle],
		CarInfo[idx][cColorOne],
		CarInfo[idx][cColorTwo],
		CarInfo[idx][cLicense]);
		if(idx == 0)
		{
			file2 = fopen("cars.cfg", io_write);
		}
		else
		{
			file2 = fopen("cars.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
	return 1;
}
Reply


Messages In This Thread
scripts that create problems - by EleMenTalL - 19.11.2011, 20:52
Re: scripts that create problems - by Joe Staff - 19.11.2011, 20:57
Re: scripts that create problems - by EleMenTalL - 20.11.2011, 09:32
Re: scripts that create problems - by EleMenTalL - 20.11.2011, 09:38

Forum Jump:


Users browsing this thread: 1 Guest(s)