Question

Здравствуйте Ув.Участиники PAWNO-RUS,

Столкнулся с проблемой - *Транспорт сломанный при загрузке на сервер* То есть загружаешь Т.С после покупки с 50% состоянии

С исправлением затрудняюсь, может вы можете как то помочь.

Заранее спасибо!

 

Спойлер

CMD:fixcar(playerid)
{
	STRING_GLOBAL[0] = EOS;

	mysql_format(dbHandle, STRING_GLOBAL, 128, "SELECT * FROM ownable_cars WHERE c_owner = '%s'", GetName(playerid));
	mysql_tquery(dbHandle, STRING_GLOBAL, "ShowOwnableMenu", "i", playerid);

	return 1;
}

 

 

Спойлер

forward ShowOwnableMenu(playerid);
public ShowOwnableMenu(playerid)
{
	new r, f;
	cache_get_data(r, f);
	if(!r) return SendClientMessage(playerid, COLOR_AC, "Личные автомобили отсутствуют");

	new status, model, id, number[64], fmt_str[128], fmt_status[50];
	
	STRING_GLOBAL[0] = EOS;

	for(new idx; idx < r; idx ++)
	{
		id = cache_get_field_content_int(idx, "id", dbHandle);
		status = cache_get_field_content_int(idx, "c_status", dbHandle);
		model = cache_get_field_content_int(idx, "c_model", dbHandle);
		cache_get_field_content(idx, "c_number", number, dbHandle);
        RepairVehicle(GetPlayerVehicleID(playerid));

		if(status == -1) format(fmt_status, 25, "{FA601D}Не загружен");
		else format(fmt_status, sizeof fmt_status, "{6AE062}Загружен (ID: %d)", status);

		format(fmt_str, 128, "{5A8FE3}%d.{FFFFFF} %s(%d) - %s {FFFFFF}- %s\n", idx+1, VehicleNames[model-400], model, number, fmt_status);
		strcat(STRING_GLOBAL, fmt_str);

		SetPlayerListitemValue(playerid, idx, status);
		SetPlayerListitemValue1(playerid, idx, id);
	}

	ShowPlayerDialogFix(playerid, DIALOG_CMENU, DIALOG_STYLE_LIST, "{5A8FE3}Ваши автомобили", STRING_GLOBAL, "Выбрать", "Отмена");

	return 1;
}

 

 

Спойлер

forward LoadOwnableCar(playerid);
public LoadOwnableCar(playerid)
{
	new slot_id = GetFreeCarSlot(playerid), string[64];
	if(slot_id == -1) return SendClientMessage(playerid, COLOR_AC, "Все слоты заняты, выгрузите предыдущий автомобиль, чтобы загрузить новый");

	new r, f;
	cache_get_data(r, f);
	if(r)
	{
	    C_DATA[playerid][slot_id][c_id] 		= 		cache_get_field_content_int(0, "id", dbHandle);
		C_DATA[playerid][slot_id][c_model] 		= 		cache_get_field_content_int(0, "c_model", dbHandle);
		C_DATA[playerid][slot_id][c_x]			=       cache_get_field_content_float(0, "c_x", dbHandle);
		C_DATA[playerid][slot_id][c_y] 			=       cache_get_field_content_float(0, "c_y", dbHandle);
		C_DATA[playerid][slot_id][c_z] 			=       cache_get_field_content_float(0, "c_z", dbHandle);
		C_DATA[playerid][slot_id][c_a] 			=       cache_get_field_content_float(0, "c_a", dbHandle);
		C_DATA[playerid][slot_id][c_color][0] 	= 		cache_get_field_content_int(0, "c_color1", dbHandle);
		C_DATA[playerid][slot_id][c_color][1] 	= 		cache_get_field_content_int(0, "c_color2", dbHandle);
		C_DATA[playerid][slot_id][c_price] 		=     	cache_get_field_content_int(0, "c_price");
		cache_get_field_content(0, "c_vehcom", C_DATA[playerid][slot_id][c_vehcom], dbHandle, 64);
		cache_get_field_content(0, "c_number", C_DATA[playerid][slot_id][c_number], dbHandle, 64);
		C_DATA[playerid][slot_id][c_world] 		= 		cache_get_field_content_int(0, "c_world", dbHandle);
		C_DATA[playerid][slot_id][c_fuel] 		= 		cache_get_field_content_int(0, "c_fuel", dbHandle);
		C_DATA[playerid][slot_id][c_health] 	= 		cache_get_field_content_int(0, "c_health", dbHandle);
		C_DATA[playerid][slot_id][c_fuel_max] 	= 		cache_get_field_content_int(0, "c_maxfuel", dbHandle);
		C_DATA[playerid][slot_id][c_engine] 	= 		cache_get_field_content_int(0, "c_engine", dbHandle);

		sscanf(C_DATA[playerid][slot_id][c_vehcom], "p<,>a<i>[14]", C_DATA[playerid][slot_id][c_vehcoms]);

        new sscanf_delimit [ 36 ] ;
		cache_get_field_content(0, "c_improve", sscanf_delimit, dbHandle, 16 ) ;
		sscanf(sscanf_delimit, "p<|>dd", C_DATA[playerid][slot_id][c_improve][0], C_DATA[playerid][slot_id][c_improve][1]);

		if(PLAYER_DATA[playerid][data_GARAGE] == -1 && C_DATA[playerid][slot_id][c_world] != 0) ClearPlayerCar(playerid, slot_id);

		if(C_DATA[playerid][slot_id][c_x] == 0 && C_DATA[playerid][slot_id][c_y] == 0 && C_DATA[playerid][slot_id][c_z] == 0)
		{
			new rand = random(sizeof SalonRandSpawn);
			PLAYER_DATA[playerid][data_OWNABLE][slot_id] = CreateVehicle(C_DATA[playerid][slot_id][c_model], SalonRandSpawn[rand][0], SalonRandSpawn[rand][1], SalonRandSpawn[rand][2], SalonRandSpawn[rand][3], C_DATA[playerid][slot_id][c_color][0], C_DATA[playerid][slot_id][c_color][1], 9000000);
			SendClientMessage(playerid, COLOR_GREEN, "Ваш автомобиль не был припаркован после покупки и был отбуксирован на спец. стоянку. Найти автомобиль -> /fixcar");
		}
		else PLAYER_DATA[playerid][data_OWNABLE][slot_id] = CreateVehicle(C_DATA[playerid][slot_id][c_model], C_DATA[playerid][slot_id][c_x], C_DATA[playerid][slot_id][c_y], C_DATA[playerid][slot_id][c_z], C_DATA[playerid][slot_id][c_a], C_DATA[playerid][slot_id][c_color][0], C_DATA[playerid][slot_id][c_color][1], 9000000);

        if(C_DATA[playerid][slot_id][c_health] < 500) SetVehicleHealth(PLAYER_DATA[playerid][data_OWNABLE][slot_id], 500);
		else SetVehicleHealth(PLAYER_DATA[playerid][data_OWNABLE][slot_id], C_DATA[playerid][slot_id][c_health]);

		CAR_DATA[PLAYER_DATA[playerid][data_OWNABLE][slot_id]][data_FUEL] = C_DATA[playerid][slot_id][c_fuel];

		if(VehicleLabel[PLAYER_DATA[playerid][data_OWNABLE][slot_id]] != Text3D:INVALID_3DTEXT_ID) DestroyVehicleLabel(PLAYER_DATA[playerid][data_OWNABLE][slot_id]);
		VehicleLabel[PLAYER_DATA[playerid][data_OWNABLE][slot_id]] = Text3D:INVALID_3DTEXT_ID;

        GetVehicleParamsEx(PLAYER_DATA[playerid][data_OWNABLE][slot_id],engine,lights,alarm,doors,bonnet,boot,objective);
		SetVehicleParamsEx(PLAYER_DATA[playerid][data_OWNABLE][slot_id],engine,lights,alarm,true,bonnet,boot,objective);
		CAR_DATA[PLAYER_DATA[playerid][data_OWNABLE][slot_id]][data_LOCK] = 1;
		
		ChangeVehiclePaintjob(PLAYER_DATA[playerid][data_OWNABLE][slot_id], cache_get_field_content_int(0, "c_paintjob"));

		for(new i = 13; i >= 0; i --)
		{
			if(C_DATA[playerid][slot_id][c_vehcoms][i] != 0) AddVehicleComponent(PLAYER_DATA[playerid][data_OWNABLE][slot_id], C_DATA[playerid][slot_id][c_vehcoms][i]);
		}

		if(VehicleLabel[PLAYER_DATA[playerid][data_OWNABLE][slot_id]] == Text3D:INVALID_3DTEXT_ID)
		{
			if(strcmp(C_DATA[playerid][slot_id][c_number], "None", true, 64) != 0)
			{
				format(string, 64, "{FFFFFF}%s", C_DATA[playerid][slot_id][c_number]);
				CreateVehicleLabel(PLAYER_DATA[playerid][data_OWNABLE][slot_id], string, 0xFFFFFFFF, 0.0, 0.0, 0.0, 20.0);
			}
			else CreateVehicleLabel(PLAYER_DATA[playerid][data_OWNABLE][slot_id], "---------", 0xFFFFFFFF, 0.0, 0.0, 0.0, 20.0);
		}
		
		SetVehicleVirtualWorld(PLAYER_DATA[playerid][data_OWNABLE][slot_id], C_DATA[playerid][slot_id][c_world]);

		ChangeVehicleColor(PLAYER_DATA[playerid][data_OWNABLE][slot_id], C_DATA[playerid][slot_id][c_color][0], C_DATA[playerid][slot_id][c_color][1]);

		SendMes(playerid, COLOR_GREEN, "Автомобиль (ID: %d) успешно загружен в игру. Найти автомобиль: /fixcar", PLAYER_DATA[playerid][data_OWNABLE][slot_id]);

		STRING_GLOBAL[0] = EOS;
		mysql_format(dbHandle, STRING_GLOBAL, 128, "UPDATE `ownable_cars` SET c_status = '%d' WHERE c_owner = '%s' AND id = '%d'", PLAYER_DATA[playerid][data_OWNABLE][slot_id], GetName(playerid), GetPVarInt(playerid, "load_car_id"));
		mysql_tquery(dbHandle, STRING_GLOBAL, "", "");

		SetVehicleNumberPlate(PLAYER_DATA[playerid][data_OWNABLE][slot_id], C_DATA[playerid][slot_id][c_number]);

	}
	else SendClientMessage(playerid, COLOR_RED, "Системная ошибка #1: обратитесь к администратору");

	return 1;
}

 

 

Edited by Jawn

Заметка от Cawfee , создано

Пожалуйста, не путайте теги спойлер и код. Как пользоваться спойлером?

Share this post


Link to post

0 answers to this question

There have been no answers to this question yet

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • Kutuzov
      By Kutuzov
      Всем привет, хотелось бы спросить у тех, кто разбирается в PluginSDK.
      Какие есть источники, руководства, документации о PluginSDK?
      Я пока что ничего нормального не нахожу.
      Заранее спасибо