SA-MP Forums Archive
Problema concesionario - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Problema concesionario (/showthread.php?tid=588969)



Problema concesionario - M@ty - 14.09.2015

Hola, implemente un sistema de coches a la venta en mi gm, y se me guarda todo, cuando compro y desconecto se guarda el vehiculo y el vehiculo a la venta tambien sigue en venta, solamente cuando reinicio el servidor, el coche a la venta desaparece, saben que podria ser? o en que callback me faltaria el loadCarsale o saveCarsale.
Gracias.


Respuesta: Problema concesionario - Zume - 14.09.2015

En loadCarsale , mostrб esa funciуn


Respuesta: Problema concesionario - M@ty - 14.09.2015

Код:
loadCarSale()
{
	if(!fexist("carsale.cfg")) return 1;
	new text_info[68],szFileStr[1024],File: iFileHandle = fopen("carsale.cfg", io_read),iIndex;
	while(iIndex < sizeof(varCarSale) && fread(iFileHandle, szFileStr))
	{
		sscanf(szFileStr, "p<|>ffffffffii",
		    varCarSale[iIndex][CSVehSpawn][0],
			varCarSale[iIndex][CSVehSpawn][1],
			varCarSale[iIndex][CSVehSpawn][2],
			varCarSale[iIndex][CSVehSpawn][3],
		    varCarSale[iIndex][VehSpawn][0],
			varCarSale[iIndex][VehSpawn][1],
			varCarSale[iIndex][VehSpawn][2],
			varCarSale[iIndex][VehSpawn][3],
			varCarSale[iIndex][CSVehCost],
			varCarSale[iIndex][CSVehModel]);
		if(varCarSale[iIndex][CSVehModel] > 410)
		{
	    	new carcreated = CreateVehicle(varCarSale[iIndex][CSVehModel], varCarSale[iIndex][CSVehSpawn][0], varCarSale[iIndex][CSVehSpawn][1], varCarSale[iIndex][CSVehSpawn][2], varCarSale[iIndex][CSVehSpawn][3], 0, 0, 6);
	    	format(text_info, sizeof(text_info), "(%d) %s en Venta | Precio: %d", iIndex,GetVehicleName(carcreated), varCarSale[iIndex][CSVehCost]);
			varCarSale[iIndex][CSVehicleLabel] = CreateDynamic3DTextLabel(text_info,COLOR_GENERAL,0.0, 0.0, 0.0,8.0,INVALID_PLAYER_ID,carcreated);
			varCarSale[iIndex][CSVehId] = carcreated;
		}
		++iIndex;
	}
	print("[script] Sale Cars Loaded Successfully . . .");
	return fclose(iFileHandle);
}
Y saveCarSale por las dudas

Код:
saveCarSale()
{
	new szFileStr[512],File: fHandle = fopen("carsale.cfg", io_write);

	for(new iIndex; iIndex < MAX_CARSALE; iIndex++)
	{
	    format(szFileStr, sizeof(szFileStr), "%f|%f|%f|%f|%f|%f|%f|%f|%d|%d\r\n",
		    varCarSale[iIndex][CSVehSpawn][0],
			varCarSale[iIndex][CSVehSpawn][1],
			varCarSale[iIndex][CSVehSpawn][2],
			varCarSale[iIndex][CSVehSpawn][3],
		    varCarSale[iIndex][VehSpawn][0],
			varCarSale[iIndex][VehSpawn][1],
			varCarSale[iIndex][VehSpawn][2],
			varCarSale[iIndex][VehSpawn][3],
			varCarSale[iIndex][CSVehCost],
			varCarSale[iIndex][CSVehModel]);
	    fwrite(fHandle, szFileStr);
	}
	//print("[script] Car Sale Saved Successfully . . .");
	return fclose(fHandle);
}
Gracias _Zume