Вопросы

Всем привет. Заметил такой баг: Если в СТО выбрать например для машины новый цвет, то можно просто нажать ESC, тогда вы выйдите из СТО, цвет машины сохранится и деньги не снимутся. Как сделать, что бы при выходе через ESC - изменения не сохранились, если ты не оплатил?

P.S. СТО на текстдравах

 

Код:

Спойлер

else if(PI[playerid][P_TUNING_TYPE] != -1)
		{
			if(!GetPVarInt(playerid, "UsedCTO")) return 0;
			new bizzid = GetPVarInt(playerid,"CTObizzid");
			if(GetPlayerState(playerid) != 2) return SKick(playerid, 12221);
			new pveh = GetPlayerVehicleID(playerid);
			SetVehiclePos(pveh,BizzInfo[bizzid][bEntrx],BizzInfo[bizzid][bEntry],BizzInfo[bizzid][bEntrz]);
			SetVehicleZAngle(pveh, g_vehicle[pveh][veh_a]);
			SetVehicleHealth(pveh, 1000.0);
			DeletePVar(playerid,"UsedCTO");
			SetPVarInt(playerid, "AntiBreik", 3);
			SetVehicleZAngle(pveh, 90.0);
			SetPlayerInterior(playerid,0);
			SetPlayerVirtualWorld(playerid,0);
			SetVehicleVirtualWorld(pveh,0);
			LinkVehicleToInterior(pveh,0);
			PutPlayerInVehicle(playerid, pveh, 0);
			TogglePlayerControllable(playerid,true);
			SetCameraBehindPlayer(playerid);

    		for(new i = 0; i < sizeof sto_td_player; i ++) PlayerTextDrawHide(playerid, sto_td_player[i][playerid]);
			for(new i; i < sizeof sto_td_global; i ++) TextDrawHideForPlayer(playerid, sto_td_global[i]);

    		CancelSelectTextDraw(playerid);

			PI[playerid][P_TUNING_TYPE] = -1;
		}
		else if(PI[playerid][SalonCarID] != INVALID_VEHICLE_ID)
		{
			if(1 <= InShop[playerid] <= 2)
			{
				BuyCloseCar(playerid);
			}
		}
    }
	if(clickedid == autosalon_global_td[54])
	{
		BuyCar(playerid);
	}
	if(clickedid == autosalon_global_td[66])
	{
		BuyCloseCar(playerid);
	}
	if(clickedid == autosalon_global_td[20])
	{
		if((GetTickCount() - PlayerLastTick[playerid]) < 1000) return 1;

		new salon = PI[playerid][P_SALON];

		if(salon == 0)
		{
			if(pPressed[playerid] == 0)
				pPressed[playerid] = 24;
			else
				pPressed[playerid] -- ;
		}
		else if(salon == 1)
		{
			if(pPressed[playerid] == 0)
				pPressed[playerid] = 4;
			else
				pPressed[playerid] -- ;
		}

		new idx = pPressed[playerid];

		DestroyVehicle(PI[playerid][SalonCarID]);
		PI[playerid][SalonCarID] = CreateVehicle(car_market_data[salon][idx][0],  -358.7720, 379.9233, 1002.0958, -140.0000, PI[playerid][P_COLOR][0], PI[playerid][P_COLOR][1], 10000);
		LinkVehicleToInterior(PI[playerid][SalonCarID],3);
		SetVehicleVirtualWorld(PI[playerid][SalonCarID],playerid);
		PutPlayerInVehicle(playerid,PI[playerid][SalonCarID],0);

		SetPlayerCameraPos(playerid, -351.8433, 373.5243, 1004.1419);
		SetPlayerCameraLookAt(playerid, -352.5201, 374.2586, 1003.8023);

		STRING_GLOBAL[0] = EOS;
		format(STRING_GLOBAL, sizeof STRING_GLOBAL, "%s", g_vehicle_info[car_market_data[salon][idx][0]-400][VI_NAME]);
		PlayerTextDrawSetString(playerid, autosalon_player_td[playerid][1], STRING_GLOBAL);

		STRING_GLOBAL[0] = EOS;
		format(STRING_GLOBAL, sizeof STRING_GLOBAL, "%d_руб", g_vehicle_info[car_market_data[salon][idx][0]-400][VI_COST]);
		PlayerTextDrawSetString(playerid, autosalon_player_td[playerid][0], STRING_GLOBAL);

		PlayerLastTick[playerid] = GetTickCount();
	}
	if(clickedid == autosalon_global_td[21])
	{
		if((GetTickCount() - PlayerLastTick[playerid]) < 1000) return 1;

		new salon = PI[playerid][P_SALON];

		if(salon == 0)
		{
			if(pPressed[playerid] == 24)
				pPressed[playerid] = 0;
			else
				pPressed[playerid] ++;
		}
		else if(salon == 1)
		{
			if(pPressed[playerid] == 4)
				pPressed[playerid] = 0;
			else
				pPressed[playerid] ++;
		}

		new idx = pPressed[playerid];

		DestroyVehicle(PI[playerid][SalonCarID]);
		PI[playerid][SalonCarID] = CreateVehicle(car_market_data[salon][idx][0],  -358.7720, 379.9233, 1002.0958, -140.0000, PI[playerid][P_COLOR][0], PI[playerid][P_COLOR][1], 10000);

		LinkVehicleToInterior(PI[playerid][SalonCarID],3);
		SetVehicleVirtualWorld(PI[playerid][SalonCarID],playerid);
		PutPlayerInVehicle(playerid,PI[playerid][SalonCarID],0);

		SetPlayerCameraPos(playerid, -351.8433, 373.5243, 1004.1419);
		SetPlayerCameraLookAt(playerid, -352.5201, 374.2586, 1003.8023);

		STRING_GLOBAL[0] = EOS;
		format(STRING_GLOBAL, sizeof STRING_GLOBAL, "%s", g_vehicle_info[car_market_data[salon][idx][0]-400][VI_NAME]);
		PlayerTextDrawSetString(playerid, autosalon_player_td[playerid][1], STRING_GLOBAL);

		STRING_GLOBAL[0] = EOS;
		format(STRING_GLOBAL, sizeof STRING_GLOBAL, "%d_руб", g_vehicle_info[car_market_data[salon][idx][0]-400][VI_COST]);
		PlayerTextDrawSetString(playerid, autosalon_player_td[playerid][0], STRING_GLOBAL);

		PlayerLastTick[playerid] = GetTickCount();
	}
	if(clickedid == autosalon_global_td[32])
	{
		if((GetTickCount() - PlayerLastTick[playerid]) < 1000) return 1;

		if(PI[playerid][P_COLOR][0] == 255)
			PI[playerid][P_COLOR][0] = 0;
		else
			PI[playerid][P_COLOR][0] += 1;

		ChangeVehicleColor(PI[playerid][SalonCarID], PI[playerid][P_COLOR][0], PI[playerid][P_COLOR][1]);

		PlayerLastTick[playerid] = GetTickCount();
	}
	if(clickedid == autosalon_global_td[33])
	{
		if((GetTickCount() - PlayerLastTick[playerid]) < 1000) return 1;

		if(PI[playerid][P_COLOR][0] == 0)
			PI[playerid][P_COLOR][0] = 255;
		else
			PI[playerid][P_COLOR][0] -= 1;

		ChangeVehicleColor(PI[playerid][SalonCarID], PI[playerid][P_COLOR][0], PI[playerid][P_COLOR][1]);

		PlayerLastTick[playerid] = GetTickCount();
	}
	if(clickedid == autosalon_global_td[45])
	{
		if((GetTickCount() - PlayerLastTick[playerid]) < 1000) return 1;

		if(PI[playerid][P_COLOR][1] == 255)
			PI[playerid][P_COLOR][1] = 0;
		else
			PI[playerid][P_COLOR][1] += 1;

		ChangeVehicleColor(PI[playerid][SalonCarID], PI[playerid][P_COLOR][0], PI[playerid][P_COLOR][1]);

		PlayerLastTick[playerid] = GetTickCount();
	}
	if(clickedid == autosalon_global_td[46])
	{
		if((GetTickCount() - PlayerLastTick[playerid]) < 1000) return 1;

		if(PI[playerid][P_COLOR][1] == 0)
			PI[playerid][P_COLOR][1] = 255;
		else
			PI[playerid][P_COLOR][1] -= 1;

		ChangeVehicleColor(PI[playerid][SalonCarID], PI[playerid][P_COLOR][0], PI[playerid][P_COLOR][1]);

		PlayerLastTick[playerid] = GetTickCount();
	}
	if(PI[playerid][P_TUNING_TYPE] != -1)
	{
		if(clickedid == sto_td_global[6])
		{
			PI[playerid][P_TUNING_TYPE] = 1;

			PlayerTextDrawSetString(playerid, sto_td_player[0][playerid], "цвет");

			PlayerTextDrawSetString
			(
				playerid,
				sto_td_player[1][playerid],
				"используя_элементы_интерфейса,~n~выберите_предпочитаемый_цвет~n~для_личного_автомобиля."
			);


			new biz_id = GetPVarInt(playerid, "CTObizzid"),
			price = BizzInfo[biz_id][bTill]*5;

			STRING_GLOBAL[0] = EOS;
			format
			(
				STRING_GLOBAL, sizeof STRING_GLOBAL,
				"основной_цвет:_%d~n~доп.цвет:_%d~n~К_ОПЛАТЕ:_%d_руб.", PI[playerid][P_COLOR][0], PI[playerid][P_COLOR][1], price
			);
			PlayerTextDrawSetString(playerid, sto_td_player[2][playerid], STRING_GLOBAL);

			for(new idx; idx < 4; idx ++) TextDrawHideForPlayer(playerid, sto_td_global[idx]);
			for(new idx = 2; idx < 4; idx ++) TextDrawShowForPlayer(playerid, sto_td_global[idx]);

			//TextDrawHideForPlayer(playerid, sto_td_global[0]);
			//TextDrawHideForPlayer(playerid, sto_td_global[1]);

			// основной_цвет:_24~n~доп.цвет:_52~n~К_ОПЛАТЕ:_200_руб.
			//ShowPlayerTuningColor(playerid);
		}
		if(clickedid == sto_td_global[9])
		{
			PI[playerid][P_TUNING_TYPE] = 2;

			PlayerTextDrawSetString(playerid, sto_td_player[0][playerid], "гидравлика");

			new biz_id = GetPVarInt(playerid, "CTObizzid"),
			price = BizzInfo[biz_id][bTill]*100;

			STRING_GLOBAL[0] = EOS;
			format
			(
				STRING_GLOBAL, sizeof STRING_GLOBAL,
				"к_оплате:_%d_рублей.", price
			);
			PlayerTextDrawSetString(playerid, sto_td_player[2][playerid], STRING_GLOBAL);

			PlayerTextDrawSetString
			(
				playerid,
				sto_td_player[1][playerid],
				"вы_действительно_хотите_~n~установить_гидравлику_~n~на_свой_транспорт?"
			);

			for(new idx; idx < 4; idx ++) TextDrawHideForPlayer(playerid, sto_td_global[idx]);

			//ShowPlayerTuningButton(playerid);
		}
		if(clickedid == sto_td_global[12])
		{
			PI[playerid][P_TUNING_TYPE] = 3;

			PlayerTextDrawSetString(playerid, sto_td_player[0][playerid], "нитро");

			PlayerTextDrawSetString
			(
				playerid,
				sto_td_player[1][playerid],
				"выберите_нитро_для~n~_вашего_транспорта,_~n~используя_стрелки"
			);

			new nitro_amount[3] = {2, 5, 10};

			new tun_state = PI[playerid][P_TUNING_STATE];

			new bizzid = GetPVarInt(playerid,"CTObizzid");
			new till = BizzInfo[bizzid][bTill];

			new price;

			switch(tun_state)
			{
				case 1: price = till*80;
				case 2: price = till*150;
				case 3: price = till*300;
			}

			STRING_GLOBAL[0] = EOS;
			format
			(
				STRING_GLOBAL, sizeof STRING_GLOBAL,
				"балон_нитро:_%d~N~объем:_%d_л~n~стоимость:_%d_рублей", tun_state, nitro_amount[tun_state-1], price
			);
			PlayerTextDrawSetString(playerid, sto_td_player[2][playerid], STRING_GLOBAL);

			for(new idx; idx < 4; idx ++) TextDrawHideForPlayer(playerid, sto_td_global[idx]);
			for(new idx; idx < 2; idx ++) TextDrawShowForPlayer(playerid, sto_td_global[idx]);

			//ShowPlayerTuningSelect(playerid);
		}
		if(clickedid == sto_td_global[15])
		{
			PI[playerid][P_TUNING_STATE] = 1;
			AddVehicleComponent(GetPlayerVehicleID(playerid), g_tuning_disks[0][D_COMPONENT]);

			PI[playerid][P_TUNING_TYPE] = 4;

			PlayerTextDrawSetString(playerid, sto_td_player[0][playerid], "диски");

			PlayerTextDrawSetString
			(
				playerid,
				sto_td_player[1][playerid],
				"выберите_диски_для~n~вашего_транспорта,~n~используя_стрелки"
			);

			new tun_state = PI[playerid][P_TUNING_STATE];

			new bizzid = GetPVarInt(playerid,"CTObizzid");
			new till = BizzInfo[bizzid][bTill];

			AddVehicleComponent(GetPlayerVehicleID(playerid), g_tuning_disks[tun_state-1][D_COMPONENT]);

			STRING_GLOBAL[0] = EOS;
			format(STRING_GLOBAL, sizeof STRING_GLOBAL, "диски:_%d~N~название:_%s~n~стоимость:_%d_рублей", tun_state, g_tuning_disks[tun_state-1][D_NAME], till*g_tuning_disks[tun_state-1][D_PRICE]);
			PlayerTextDrawSetString(playerid, sto_td_player[2][playerid], STRING_GLOBAL);

			for(new idx; idx < 4; idx ++) TextDrawHideForPlayer(playerid, sto_td_global[idx]);
			for(new idx; idx < 2; idx ++) TextDrawShowForPlayer(playerid, sto_td_global[idx]);

			//ShowPlayerTuningSelect(playerid);
		}
		if(clickedid == sto_td_global[18])
		{
			PI[playerid][P_TUNING_TYPE] = 5;

			PlayerTextDrawSetString(playerid, sto_td_player[0][playerid], "винилы");

			PlayerTextDrawSetString
			(
				playerid,
				sto_td_player[1][playerid],
				"выберите_винилы_для~n~вашего_транспорта,~n~используя_стрелки"
			);

			new tun_state = PI[playerid][P_TUNING_STATE];

			new bizzid = GetPVarInt(playerid,"CTObizzid");
			new till = BizzInfo[bizzid][bTill];

			new price_paintjob[3] = {30, 35, 40};

			ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), tun_state-1);

			STRING_GLOBAL[0] = EOS;
			format(STRING_GLOBAL, sizeof STRING_GLOBAL, "винилы:_%d~N~стоимость:_%d_рублей", tun_state, till*price_paintjob[tun_state-1]);
			PlayerTextDrawSetString(playerid, sto_td_player[2][playerid], STRING_GLOBAL);

			for(new idx; idx < 4; idx ++) TextDrawHideForPlayer(playerid, sto_td_global[idx]);
			for(new idx; idx < 2; idx ++) TextDrawShowForPlayer(playerid, sto_td_global[idx]);

			//ShowPlayerTuningSelect(playerid);
		}
		if(clickedid == sto_td_global[21])
		{
			PI[playerid][P_TUNING_TYPE] = 6;

			PlayerTextDrawSetString(playerid, sto_td_player[0][playerid], "ремонт");

			PlayerTextDrawSetString
			(
				playerid,
				sto_td_player[1][playerid],
				"вы_действительно_хотите_~n~отремонтировать_,~n~свой_транспорт?"
			);

			PlayerTextDrawSetString(playerid, sto_td_player[2][playerid], "стоимость:_1000 рублей");

			for(new idx; idx < 4; idx ++) TextDrawHideForPlayer(playerid, sto_td_global[idx]);

			//ShowPlayerTuningButton(playerid);
		}
		if(clickedid == sto_td_global[24])
		{
			PI[playerid][P_TUNING_TYPE] = 7;

			PlayerTextDrawSetString(playerid, sto_td_player[0][playerid], "улучш._двиг");

			PlayerTextDrawSetString
			(
				playerid,
				sto_td_player[1][playerid],
				"выберите_двигатель_для~n~вашего_транспорта,~n~используя_стрелки?"
			);

			new tun_state = PI[playerid][P_TUNING_STATE];

			PI[playerid][P_TUNING_STATE] = tun_state;

			STRING_GLOBAL[0] = EOS;
			format(STRING_GLOBAL, sizeof STRING_GLOBAL, "двигатель:_%s~N~прибавка_к_макс._скор.:_%d_км/ч~n~стоимость:_%d_млн._рублей", g_tuning_engine[tun_state-1][E_NAME], g_tuning_engine[tun_state-1][E_MAX_SPEED], g_tuning_engine[tun_state-1][E_PRICE]);
			PlayerTextDrawSetString(playerid, sto_td_player[2][playerid], STRING_GLOBAL);

			for(new idx; idx < 4; idx ++) TextDrawHideForPlayer(playerid, sto_td_global[idx]);
			for(new idx; idx < 2; idx ++) TextDrawShowForPlayer(playerid, sto_td_global[idx]);

			//ShowPlayerTuningSelect(playerid);
		}
		/* COMPLETE */


		if(PI[playerid][P_TUNING_TYPE] == 1)
		{
			if(clickedid == sto_td_global[2])
			{
				ShowPlayerDialog
				(
					playerid, DIALOG_STO_CHANGE_COLOR, DIALOG_STYLE_INPUT,
					"{FFCC00}Смена цвета",
					"{FFFFFF}Введите номер цвета:",
					"Далее", "Отмена"
				);

				SetPVarInt(playerid, "color_type", 1);
			}
			if(clickedid == sto_td_global[3])
			{
				ShowPlayerDialog
				(
					playerid, DIALOG_STO_CHANGE_COLOR, DIALOG_STYLE_INPUT,
					"{FFCC00}Смена цвета",
					"{FFFFFF}Введите номер цвета:",
					"Далее", "Отмена"
				);

				SetPVarInt(playerid, "color_type", 2);
			}
		}

		if(PI[playerid][P_TUNING_TYPE] == 3)
		{
			if(clickedid == sto_td_global[0])
			{
				new tun_state = PI[playerid][P_TUNING_STATE];

				if(tun_state == 1)
					tun_state = 3;
				else
					tun_state -= 1;

				PI[playerid][P_TUNING_STATE] = tun_state;

				new nitro_amount[3] = {2, 5, 10};

				new bizzid = GetPVarInt(playerid,"CTObizzid");
                new till = BizzInfo[bizzid][bTill];

				new price;

				switch(tun_state)
				{
					case 1: price = till*80;
					case 2: price = till*150;
					case 3: price = till*300;
				}

				STRING_GLOBAL[0] = EOS;
				format
				(
					STRING_GLOBAL, sizeof STRING_GLOBAL,
					"балон_нитро:_%d~N~объем:_%d_л~n~стоимость:_%d_рублей", tun_state, nitro_amount[tun_state-1], price
				);
				PlayerTextDrawSetString(playerid, sto_td_player[2][playerid], STRING_GLOBAL);
			}
			if(clickedid == sto_td_global[1])
			{
				new tun_state = PI[playerid][P_TUNING_STATE];

				if(tun_state == 3)
					tun_state = 1;
				else
					tun_state += 1;

				PI[playerid][P_TUNING_STATE] = tun_state;

				new nitro_amount[3] = {2, 5, 10};

				new bizzid = GetPVarInt(playerid,"CTObizzid");
                new till = BizzInfo[bizzid][bTill];

				new price;

				switch(tun_state)
				{
					case 1: price = till*80;
					case 2: price = till*150;
					case 3: price = till*300;
				}

				STRING_GLOBAL[0] = EOS;
				format
				(
					STRING_GLOBAL, sizeof STRING_GLOBAL,
					"балон_нитро:_%d~N~объем:_%d_л~n~стоимость:_%d_рублей", tun_state, nitro_amount[tun_state-1], price
				);
				PlayerTextDrawSetString(playerid, sto_td_player[2][playerid], STRING_GLOBAL);
			}
		}

		if(PI[playerid][P_TUNING_TYPE] == 4)
		{
			if(clickedid == sto_td_global[0])
			{
				new tun_state = PI[playerid][P_TUNING_STATE];

				new bizzid = GetPVarInt(playerid,"CTObizzid");
                new till = BizzInfo[bizzid][bTill];

				if(tun_state == 1)
					tun_state = 10;
				else
					tun_state -= 1;

				PI[playerid][P_TUNING_STATE] = tun_state;

				AddVehicleComponent(GetPlayerVehicleID(playerid), g_tuning_disks[tun_state-1][D_COMPONENT]);
				printf("tun_state: %d componentid %d", tun_state, g_tuning_disks[tun_state-1][D_COMPONENT]);

				STRING_GLOBAL[0] = EOS;
				format(STRING_GLOBAL, sizeof STRING_GLOBAL, "диски:_%d~N~название:_%s~n~стоимость:_%d_рублей", tun_state, g_tuning_disks[tun_state-1][D_NAME], till*g_tuning_disks[tun_state-1][D_PRICE]);
				PlayerTextDrawSetString(playerid, sto_td_player[2][playerid], STRING_GLOBAL);
			}
			if(clickedid == sto_td_global[1])
			{
				new tun_state = PI[playerid][P_TUNING_STATE];

				new bizzid = GetPVarInt(playerid,"CTObizzid");
                new till = BizzInfo[bizzid][bTill];

				if(tun_state == 10)
					tun_state = 1;
				else
					tun_state += 1;

				PI[playerid][P_TUNING_STATE] = tun_state;

				AddVehicleComponent(GetPlayerVehicleID(playerid), g_tuning_disks[tun_state-1][D_COMPONENT]);

				STRING_GLOBAL[0] = EOS;
				format(STRING_GLOBAL, sizeof STRING_GLOBAL, "диски:_%d~N~название:_%s~n~стоимость:_%d_рублей", tun_state, g_tuning_disks[tun_state-1][D_NAME], till*g_tuning_disks[tun_state-1][D_PRICE]);
				PlayerTextDrawSetString(playerid, sto_td_player[2][playerid], STRING_GLOBAL);
			}
		}

		if(PI[playerid][P_TUNING_TYPE] == 5)
		{
			if(clickedid == sto_td_global[0])
			{
				new tun_state = PI[playerid][P_TUNING_STATE];

				new bizzid = GetPVarInt(playerid,"CTObizzid");
                new till = BizzInfo[bizzid][bTill];

				new price_paintjob[3] = {30, 35, 40};

				if(tun_state == 1)
					tun_state = 3;
				else
					tun_state -= 1;

				PI[playerid][P_TUNING_STATE] = tun_state;

				ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), tun_state-1);

				STRING_GLOBAL[0] = EOS;
				format(STRING_GLOBAL, sizeof STRING_GLOBAL, "винилы:_%d~N~стоимость:_%d_рублей", tun_state, till*price_paintjob[tun_state-1]);
				PlayerTextDrawSetString(playerid, sto_td_player[2][playerid], STRING_GLOBAL);
			}
			if(clickedid == sto_td_global[1])
			{
				new tun_state = PI[playerid][P_TUNING_STATE];

				new bizzid = GetPVarInt(playerid,"CTObizzid");
                new till = BizzInfo[bizzid][bTill];

				new price_paintjob[3] = {30, 35, 40};

				if(tun_state == 3)
					tun_state = 1;
				else
					tun_state += 1;

				PI[playerid][P_TUNING_STATE] = tun_state;

				ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), tun_state-1);

				STRING_GLOBAL[0] = EOS;
				format(STRING_GLOBAL, sizeof STRING_GLOBAL, "винилы:_%d~N~стоимость:_%d_рублей", tun_state, till*price_paintjob[tun_state-1]);
				PlayerTextDrawSetString(playerid, sto_td_player[2][playerid], STRING_GLOBAL);
			}
		}
		if(PI[playerid][P_TUNING_TYPE] == 7)
		{
			if(clickedid == sto_td_global[0])
			{
				new tun_state = PI[playerid][P_TUNING_STATE];

				if(tun_state == 1)
					tun_state = 3;
				else
					tun_state -= 1;

				PI[playerid][P_TUNING_STATE] = tun_state;

				STRING_GLOBAL[0] = EOS;
				format(STRING_GLOBAL, sizeof STRING_GLOBAL, "двигатель:_%s~N~прибавка_к_макс._скор.:_%d_км/ч~n~стоимость:_%d_млн._рублей", g_tuning_engine[tun_state-1][E_NAME], g_tuning_engine[tun_state-1][E_MAX_SPEED], g_tuning_engine[tun_state-1][E_PRICE]);
				PlayerTextDrawSetString(playerid, sto_td_player[2][playerid], STRING_GLOBAL);
			}
			if(clickedid == sto_td_global[1])
			{
				new tun_state = PI[playerid][P_TUNING_STATE];

				if(tun_state == 3)
					tun_state = 1;
				else
					tun_state += 1;

				PI[playerid][P_TUNING_STATE] = tun_state;

				STRING_GLOBAL[0] = EOS;
				format(STRING_GLOBAL, sizeof STRING_GLOBAL, "двигатель:_%s~N~прибавка_к_макс._скор.:_%d_км/ч~n~стоимость:_%d_млн._рублей", g_tuning_engine[tun_state-1][E_NAME], g_tuning_engine[tun_state-1][E_MAX_SPEED], g_tuning_engine[tun_state-1][E_PRICE]);
				PlayerTextDrawSetString(playerid, sto_td_player[2][playerid], STRING_GLOBAL);
			}
		}

		if(clickedid == sto_td_global[25])
		{
			switch(PI[playerid][P_TUNING_TYPE])
			{
				case 1:
				{
					new i = GetPVarInt(playerid,"CTObizzid");
					new till = BizzInfo[i][bTill];
					new vehicleid = GetPlayerVehicleID(playerid);
					if(GetMoney(playerid) < till*5) return SendMess(playerid, MSG_NOT_MONEY);
					GiveMoney(playerid, -till*5);
					if(BizzInfo[i][bProduct] > 0)
					{
						BizzInfo[i][bMoney] += till*5;
						BizzInfo[i][bProduct] -= 5;
						BizzPay[i] += till*5;
						MysqlUpdateBizzInt(i, "money", BizzInfo[i][bMoney]);
						MysqlUpdateBizzInt(i, "product", BizzInfo[i][bProduct]);
					}
					g_vehicle[vehicleid][veh_color][0] = PI[playerid][P_COLOR][0];
					g_vehicle[vehicleid][veh_color][1] = PI[playerid][P_COLOR][1];
					ChangeVehicleColor(vehicleid, PI[playerid][P_COLOR][0], PI[playerid][P_COLOR][1]);

					STRING_GLOBAL[0] = EOS;

					format(STRING_GLOBAL, sizeof STRING_GLOBAL, "UPDATE ownable_cars SET color_1=%d, color_2=%d WHERE id=%d", PI[playerid][P_COLOR][0], PI[playerid][P_COLOR][1], GetVehicleData(vehicleid, veh_sql_id));
					mysql_query(dbHandle, STRING_GLOBAL);

					SendClientMessage(playerid, C_OSNOV, "Вы успешно перекрасили свой транспорт");
				}
				case 2:
				{
					if(GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_HYDRAULICS) != 1087)
					{
						new i = GetPVarInt(playerid,"CTObizzid");
						new till = BizzInfo[i][bTill];

						if(GetMoney(playerid) < till*100) return SendMess(playerid, MSG_NOT_MONEY);
						GiveMoney(playerid, -till*100);
						if(BizzInfo[i][bProduct] > 0)
						{
							BizzInfo[i][bMoney] += till*100;
							BizzInfo[i][bProduct] -= 100;
							BizzPay[i] += till*100;
							MysqlUpdateBizzInt(i, "money", BizzInfo[i][bMoney]);
							MysqlUpdateBizzInt(i, "product", BizzInfo[i][bProduct]);
						}
						SendClientMessage(playerid, C_OSNOV, "Вы успешно установили гидравлику на свой транспорт");
						AddVehicleComponent(GetPlayerVehicleID(playerid), 1087);
					}
					else
					{
						SendClientMessage(playerid, C_OSNOV, "Вы успешно удалили гидравлику со своего транспорта");
						RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1087);
					}
					SaveVehicleTuning(playerid);
				}
				case 3:
				{
					new tun_state = PI[playerid][P_TUNING_STATE]-1;

					new i = GetPVarInt(playerid,"CTObizzid");
					new till = BizzInfo[i][bTill];

					new nitro_names[3][10] = {"Nitro x2", "Nitro x5", "Nitro x10"};
					new nitro_component[3] = {1009, 1008, 1010};
					new nitro_price[3] = {80, 150, 300};

					if(GetMoney(playerid) < till*nitro_price[tun_state]) return SendMess(playerid, MSG_NOT_MONEY);
					GiveMoney(playerid, -till*nitro_price[tun_state]);
					if(BizzInfo[i][bProduct] > 0)
					{
						BizzInfo[i][bMoney] += till*80;
						BizzInfo[i][bProduct] -= 80;
						BizzPay[i] += till*80;
						MysqlUpdateBizzInt(i, "money", BizzInfo[i][bMoney]);
						MysqlUpdateBizzInt(i, "product", BizzInfo[i][bProduct]);
					}
					STRING_GLOBAL[0] = EOS;
					format(STRING_GLOBAL, sizeof STRING_GLOBAL, "Вы успешно установили на свой транспорт %s за %d рублей", nitro_names[tun_state], till*nitro_price[tun_state]);
					SendClientMessage(playerid, C_OSNOV, STRING_GLOBAL);

					AddVehicleComponent(GetPlayerVehicleID(playerid), nitro_component[tun_state]);
					SaveVehicleTuning(playerid);

					PI[playerid][P_TUNING_STATE] = 1;
				}
				case 4:
				{
					new tun_state = PI[playerid][P_TUNING_STATE];

					new i = GetPVarInt(playerid,"CTObizzid");
					new till = BizzInfo[i][bTill];

					if(GetMoney(playerid) < till*g_tuning_disks[tun_state-1][D_PRICE]) return SendMess(playerid, MSG_NOT_MONEY);
					GiveMoney(playerid, -till*g_tuning_disks[tun_state-1][D_PRICE]);

					if(BizzInfo[i][bProduct] > 0)
					{
						BizzInfo[i][bMoney] += till*g_tuning_disks[tun_state-1][D_PRICE];
						BizzInfo[i][bProduct] -= g_tuning_disks[tun_state-1][D_PRODUCT];
						BizzPay[i] += till*g_tuning_disks[tun_state-1][D_PRICE];
						MysqlUpdateBizzInt(i, "money", BizzInfo[i][bMoney]);
						MysqlUpdateBizzInt(i, "product", BizzInfo[i][bProduct]);
					}
					STRING_GLOBAL[0] = EOS;
					format(STRING_GLOBAL, sizeof STRING_GLOBAL, "Вы успешно установили диски %s на свой транспорт за %d рублей", g_tuning_disks[tun_state-1][D_NAME], till*g_tuning_disks[tun_state-1][D_PRICE]);
					SendClientMessage(playerid, C_OSNOV, STRING_GLOBAL);

					SaveVehicleTuning(playerid);

					PI[playerid][P_TUNING_STATE] = 1;
				}
				case 5:
				{
					new tun_state = PI[playerid][P_TUNING_STATE];
					new vehicleid = GetPlayerVehicleID(playerid);
					new i = GetPVarInt(playerid,"CTObizzid");
					new till = BizzInfo[i][bTill];

					new price_paintjob[3] = {30, 35, 40};

					if(GetMoney(playerid) < till*price_paintjob[tun_state-1]) return SendMess(playerid, MSG_NOT_MONEY);
					GiveMoney(playerid, -till*price_paintjob[tun_state-1]);

					if(BizzInfo[i][bProduct] > 0)
					{
						BizzInfo[i][bMoney] += till*price_paintjob[tun_state-1];
						BizzInfo[i][bProduct] -= price_paintjob[tun_state-1];
						BizzPay[i] += till*price_paintjob[tun_state-1];
						MysqlUpdateBizzInt(i, "money", BizzInfo[i][bMoney]);
						MysqlUpdateBizzInt(i, "product", BizzInfo[i][bProduct]);
					}
					STRING_GLOBAL[0] = EOS;
					format(STRING_GLOBAL, sizeof STRING_GLOBAL, "Вы успешно установили покрасочную работу %d на свой транспорт за %d рублей", tun_state, till*price_paintjob[tun_state-1]);
					SendClientMessage(playerid, C_OSNOV, STRING_GLOBAL);

					SetVehicleData(vehicleid, veh_paintjob, tun_state-1);

					SaveVehicleTuning(playerid);

					PI[playerid][P_TUNING_STATE] = 1;
				}
				case 6:
				{
					new i = GetPVarInt(playerid,"CTObizzid");
					if(GetMoney(playerid) < 1000) return SendMess(playerid, MSG_NOT_MONEY);
					GiveMoney(playerid, -1000);
					new vehicleid = GetPlayerVehicleID(playerid);
					g_vehicle[vehicleid][veh_wear] += 1.0; // 0.1 процент
					if(BizzInfo[i][bProduct] > 0)
					{
						BizzInfo[i][bMoney] += 1000;
						BizzInfo[i][bProduct] -= 100;
						BizzPay[i] += 1000;
						MysqlUpdateBizzInt(i, "money", BizzInfo[i][bMoney]);
						MysqlUpdateBizzInt(i, "product", BizzInfo[i][bProduct]);
						RepairVehicle(GetPlayerVehicleID(playerid));
					}
					RepairVehicle(GetPlayerVehicleID(playerid));
					SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
					SendClientMessage(playerid, C_OSNOV, "Вы успешно отремонтировали свой транспорт за 1000 рублей");
				}
				case 7:
				{
					new tun_state = PI[playerid][P_TUNING_STATE];
					new vehicleid = GetPlayerVehicleID(playerid);

					if(g_vehicle[vehicleid][veh_improve] == tun_state)
						return SendClientMessage(playerid, C_RED, "У Вас уже куплено это улучшение");

					new i = GetPVarInt(playerid,"CTObizzid");
					if(GetMoney(playerid) < g_tuning_engine[tun_state-1][E_PRICE]*1000000) return SendMess(playerid, MSG_NOT_MONEY);
					GiveMoney(playerid, -g_tuning_engine[tun_state-1][E_PRICE]*1000000);
					if(BizzInfo[i][bProduct] > 0)
					{
						BizzInfo[i][bMoney] += g_tuning_engine[tun_state-1][E_PRICE]*1000000;
						BizzInfo[i][bProduct] -= 500;
						BizzPay[i] += g_tuning_engine[tun_state-1][E_PRICE]*1000000;
						MysqlUpdateBizzInt(i, "money", BizzInfo[i][bMoney]);
						MysqlUpdateBizzInt(i, "product", BizzInfo[i][bProduct]);
					}

					PI[playerid][P_TYPE_SPEED] = 0;

					SetVehicleData(vehicleid, veh_improve, tun_state);

					STRING_GLOBAL[0] = EOS;
					format(STRING_GLOBAL, sizeof STRING_GLOBAL, "UPDATE ownable_cars SET engine=%d WHERE id=%d", tun_state, g_vehicle[vehicleid][veh_sql_id]);
					mysql_query(dbHandle, STRING_GLOBAL);

					STRING_GLOBAL[0] = EOS;
					format(STRING_GLOBAL, sizeof STRING_GLOBAL, "Вы успешно установили двигатель %s на свой транспорт за %d рублей", g_tuning_engine[tun_state-1][E_NAME], g_tuning_engine[tun_state-1][E_PRICE]*1000000);
					SendClientMessage(playerid, C_OSNOV, STRING_GLOBAL);
				}
			}
		}
	}

 

 

Поделиться сообщением


Ссылка на сообщение

0 ответов на этот вопрос

Ответы на этот вопрос пока отсутствуют

Гость
Эта тема закрыта для публикации ответов.
  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу

  • Похожий контент

    • patrickk
      От patrickk
      Всем привет, решил написать dm сервер и довольно хорошим получился, даже на голову выше Goat dm. Оставил не решенную проблему тем что  у меня есть 4 локации с rp run и cj run ну а как добавить cj бег на те локации не знаю и как эта система работает. Надеюсь мне помогут знающие люди
    • Samolet
      От Samolet
      Здраствуйте, cоздаю копию Arizona на ОМП, опен мультиплеер, загрузил и подключил бд, но сервер не хочет вот лог :[2026-10-20T21:03:32+0300] [Info] Log file reloaded. Starting open.mp server (1.5.8.3079) from commit c6759bd8d265171ae3d86598895a23d5a8d92a3b Loading component $CAPI.so Successfully loaded component C-API (1.5.8.3079) with UID 10467dd8d4c56fc6 Loading component LegacyConfig.so Successfully loaded component LegacyConfig (1.5.8.3079) with UID 24ef6216838f9ffc Loading component NPCs.so Successfully loaded component NPCs (1.5.8.3079) with UID 3d0e59e87f4e90bc Loading component Recordings.so Successfully loaded component Recordings (1.5.8.3079) with UID 871144d399f5f613 Loading component Checkpoints.so Successfully loaded component Checkpoints (1.5.8.3079) with UID 44a937350d611dde Loading component TextDraws.so Successfully loaded component TextDraws (1.5.8.3079) with UID 9b5dc2b1d15c992a Loading component Pawn.so Successfully loaded component Pawn (1.5.8.3079) with UID 78906cd9f19c36a6 Loading component GangZones.so Successfully loaded component GangZones (1.5.8.3079) with UID b3351d11ee8d8056 Loading component Actors.so Successfully loaded component Actors (1.5.8.3079) with UID c81ca021eae2ad5c Loading component Pickups.so Successfully loaded component Pickups (1.5.8.3079) with UID cf304faa363dd971 Loading component Dialogs.so Successfully loaded component Dialogs (1.5.8.3079) with UID 44a111350d611dde Loading component Objects.so Successfully loaded component Objects (1.5.8.3079) with UID 59f8415f72da6160 Loading component Console.so Successfully loaded component Console (1.5.8.3079) with UID bfa24e49d0c95ee4 Loading component TextLabels.so Successfully loaded component TextLabels (1.5.8.3079) with UID a0c57ea80a009742 Loading component Variables.so Successfully loaded component Variables (1.5.8.3079) with UID 75e121848bc01fa2 Loading component Databases.so Successfully loaded component Databases (1.5.8.3079) with UID 80092e7eb5821a96 Loading component LegacyNetwork.so Successfully loaded component RakNetLegacyNetwork (1.5.8.3079) with UID ea9799fd79cf8442 Loading component CustomModels.so Successfully loaded component CustomModels (1.5.8.3079) with UID 15e3cb1e7c77ffff Loading component Menus.so Successfully loaded component Menus (1.5.8.3079) with UID 621e219eb97ee0b2 Loading component Vehicles.so Successfully loaded component Vehicles (1.5.8.3079) with UID 3f1f62ee9e22ab19 Loading component Classes.so Successfully loaded component Classes (1.5.8.3079) with UID 8cfb3183976da208 Loading component Timers.so Successfully loaded component Timers (1.5.8.3079) with UID 2ad8124c5ea257a3 Loaded 22 component(s) from /home/gs113492/components Executing Server Config... [2026-10-20T21:03:33+0300] [Info] Loading plugin: crashdetect.so [2026-10-20T21:03:33+0300] [Info] CrashDetect plugin 4.19 [2026-10-20T21:03:33+0300] [Info] Loading plugin: mapandreas.so [2026-10-20T21:03:33+0300] [Info] Loading plugin: streamer.so [2026-10-20T21:03:33+0300] [Info] *** Streamer Plugin v2.9.4 by Incognito loaded *** [2026-10-20T21:03:33+0300] [Info] Loading plugin: sscanf.so [2026-10-20T21:03:33+0300] [Info] [2026-10-20T21:03:33+0300] [Info] =============================== [2026-10-20T21:03:33+0300] [Info] sscanf plugin loaded. [2026-10-20T21:03:33+0300] [Info] Version: 2.8.3 [2026-10-20T21:03:33+0300] [Info] (c) 2018 Alex "Y_Less" Cole [2026-10-20T21:03:33+0300] [Info] =============================== [2026-10-20T21:03:33+0300] [Info] Loading plugin: TOTP.so [2026-10-20T21:03:33+0300] [Info] TOTP plugin v1.0.1 by Games loaded. [2026-10-20T21:03:33+0300] [Info] Loading plugin: mysql_static.so [2026-10-20T21:03:33+0300] [Info] >> plugin.mysql: R39-6 successfully loaded. [2026-10-20T21:03:33+0300] [Info] Loading plugin: libpawn_json.so [2026-10-20T21:03:34+0300] [Error] Function not registered: YSF_SetTickRate [2026-10-20T21:03:34+0300] [Error] Function not registered: PC_Init [2026-10-20T21:03:34+0300] [Info] [debug] Run time error 19: "File or function is not found" [2026-10-20T21:03:34+0300] [Info] [debug] PC_Init [2026-10-20T21:03:34+0300] [Info] [debug] YSF_SetTickRate [2026-10-20T21:03:34+0300] [Error] File or function is not found [2026-10-20T21:03:34+0300] [Error] Function not registered: PC_RegAlias [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_GetWriteOffset [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_Reset [2026-10-20T21:03:34+0300] [Error] Function not registered: PR_RegHandler [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_Delete [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_New [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_ResetReadPointer [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_SetWriteOffset [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_IgnoreBits [2026-10-20T21:03:34+0300] [Error] Function not registered: PR_Init [2026-10-20T21:03:34+0300] [Error] Function not registered: PR_SendRPC [2026-10-20T21:03:34+0300] [Error] Function not registered: PR_SendPacket [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_WriteValue [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_GetNumberOfBytesUsed [2026-10-20T21:03:34+0300] [Error] Function not registered: BS_ReadValue [2026-10-20T21:03:34+0300] [Error] Function not registered: PC_Init [2026-10-20T21:03:34+0300] [Info] [debug] Run time error 19: "File or function is not found" [2026-10-20T21:03:34+0300] [Info] [debug] PC_Init [2026-10-20T21:03:34+0300] [Info] [debug] BS_ReadValue [2026-10-20T21:03:34+0300] [Info] [debug] BS_GetNumberOfBytesUsed [2026-10-20T21:03:34+0300] [Info] [debug] BS_WriteValue [2026-10-20T21:03:34+0300] [Info] [debug] PR_SendPacket [2026-10-20T21:03:34+0300] [Info] [debug] PR_SendRPC [2026-10-20T21:03:34+0300] [Info] [debug] PR_Init [2026-10-20T21:03:34+0300] [Info] [debug] BS_IgnoreBits [2026-10-20T21:03:34+0300] [Info] [debug] BS_SetWriteOffset [2026-10-20T21:03:34+0300] [Info] [debug] BS_ResetReadPointer [2026-10-20T21:03:34+0300] [Info] [debug] BS_New [2026-10-20T21:03:34+0300] [Info] [debug] BS_Delete [2026-10-20T21:03:34+0300] [Info] [debug] PR_RegHandler [2026-10-20T21:03:34+0300] [Info] [debug] BS_Reset [2026-10-20T21:03:34+0300] [Info] [debug] BS_GetWriteOffset [2026-10-20T21:03:34+0300] [Info] [debug] PC_RegAlias [2026-10-20T21:03:34+0300] [Error] File or function is not found [2026-10-20T21:03:34+0300] [Info] [debug] Run time error 19: "File or function is not found" [2026-10-20T21:03:34+0300] [Info] [debug] PC_Init [2026-10-20T21:03:34+0300] [Info] [debug] YSF_SetTickRate [2026-10-20T21:03:34+0300] [Error] File or function is not found [2026-10-20T21:03:34+0300] [Info] [debug] Run time error 19: "File or function is not found" [2026-10-20T21:03:34+0300] [Info] [debug] PC_Init [2026-10-20T21:03:34+0300] [Info] [debug] BS_ReadValue [2026-10-20T21:03:34+0300] [Info] [debug] BS_GetNumberOfBytesUsed [2026-10-20T21:03:34+0300] [Info] [debug] BS_WriteValue [2026-10-20T21:03:34+0300] [Info] [debug] PR_SendPacket [2026-10-20T21:03:34+0300] [Info] [debug] PR_SendRPC [2026-10-20T21:03:34+0300] [Info] [debug] PR_Init [2026-10-20T21:03:34+0300] [Info] [debug] BS_IgnoreBits [2026-10-20T21:03:34+0300] [Info] [debug] BS_SetWriteOffset [2026-10-20T21:03:34+0300] [Info] [debug] BS_ResetReadPointer [2026-10-20T21:03:34+0300] [Info] [debug] BS_New [2026-10-20T21:03:34+0300] [Info] [debug] BS_Delete [2026-10-20T21:03:34+0300] [Info] [debug] PR_RegHandler [2026-10-20T21:03:34+0300] [Info] [debug] BS_Reset [2026-10-20T21:03:34+0300] [Info] [debug] BS_GetWriteOffset [2026-10-20T21:03:34+0300] [Info] [debug] PC_RegAlias [2026-10-20T21:03:34+0300] [Info] Legacy Network started on ***.**.**.***:2717. Помогите пожалуйста