Jump to content
  • 0

Problema cars.cfg


AndrewTG01

Question

Problema intalnita (descriere): Am adaugat Vehicle Ownership-ul de pe LARP pe server-ul meu (stiu ca nu este ceva frumos) . Am adaugat o masina in cars.cfg dar in joc nu se creeaza.
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu): Spuneti-mi ce sa va dau si va dau.
Imagini / Video (optional): -
Ati incercat sa rezolvati singur?:  Da

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0
1 minute ago, AndrewTG01 said:

451, 2353.5449, 572.8694, 7.3122, 90.0000, -1, -1,Dealership,Turismo,492000,,0,0

despre asta este vorba?

Si ce sa fac cu asta? :))

Arata mi si celelalte linii si cum este extras in gm din server cfg

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

Pai nu am inteles intrebarea si deaia am spus daca asta :)) imediat o sa iti arat load car si toate cele

public LoadCar()
{
	new arrCoords[13][64];
	new strFromFile2[256];
	new File: file = fopen("cars.cfg", io_read);
	if (file)
	{
		new idx = 123;
		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]);
			CarInfo[idx][cLicense] = strval(arrCoords[10]);
			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;
}

public SaveCarCoords()
{
	new idx;
	new File: file2;
	while (idx < sizeof(CarInfo))
	{
	    new coordsstring[256];
	    format(coordsstring, sizeof(coordsstring), "%d|%f|%f|%f|%f|%d|%d\n",
		CarInfo[idx][cModel],
		CarInfo[idx][cLocationx],
		CarInfo[idx][cLocationy],
		CarInfo[idx][cLocationz],
		CarInfo[idx][cAngle],
		CarInfo[idx][cColorOne],
		CarInfo[idx][cColorTwo]);
		if(idx == 0)
		{
			file2 = fopen("cars.cfg", io_write);
		}
		else
		{
			file2 = fopen("cars.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}
	return 1;
}

asta e din onpropupdate

while (idx < sizeof(CarInfo))
	{
		new coordsstring[256];
		format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%s,%d,%d\n",
		CarInfo[idx][cModel],//
		CarInfo[idx][cLocationx],//
		CarInfo[idx][cLocationy],//
		CarInfo[idx][cLocationz],//
		CarInfo[idx][cAngle],//
		CarInfo[idx][cColorOne],//
		CarInfo[idx][cColorTwo],//
		CarInfo[idx][cOwner],//
		CarInfo[idx][cDescription],//
		CarInfo[idx][cValue],//
		CarInfo[idx][cLicense],//
		CarInfo[idx][cOwned],//
		CarInfo[idx][cLock]);
		if(idx == 123)
		{
			file2 = fopen("cars.cfg", io_write);
		}
		else
		{
			file2 = fopen("cars.cfg", io_append);
		}
		fwrite(file2, coordsstring);
		idx++;
		fclose(file2);
	}

 

Link to comment
Share on other sites

  • 0

451, 2353.5449, 572.8694, 7.3122, 90.0000, -1, -1,Dealership,Turismo,492000,,0,0

La prima vedere observai aici  ,492000,,0,0

0,,0

Adica iti lipseste penultima variabila si dupa cum m-am uitat eu este cLicense

Poate  e de acolo verifica codul

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

Am avut un server RP prin 2011-2012 si am experienta destul de maricica in GMul LARP si derivatele lui. Dealershipul de acolo este cel mai de cacat pe care am lucrat in veata mea.

Cand adaugi o masina statica in GM (la OnGameModeInit), trebuie sa incrementezi valoarea idx cu 1 (idx = nr de masini statice +1), iar cand adaugi o masina personala, in cars.cfg trebuie sa incrementezi arrayul CarInfo cu 1. (marimea trebuie sa fie egala cu nr de linii din fisier)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.