Рекомендованные сообщения



Не найдено.

1 post in this topic

Всем привет. Заметил такой баг: Если в СТО выбрать например для машины новый цвет, то можно просто нажать 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);
				}
			}
		}
	}

 

 

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   You have pasted content with formatting.   Remove formatting

  Only 75 emoticons maximum are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

Loading...
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • Игорь5878
      By Игорь5878
      Продаётся оригинальный игровой мод проекта RakNet Role Play
      В моде присутствует множество уникальных систем например пару примеров: уникальная система крафта оружия/патронов, система чердаков, автосалонов.
      В продажу мода входит: Группа ВК проекта - vk.com/raknet_official Свободная группа - vk.com/raknet_fr
      Сайт/форум проекта - raknetrp.ru
      Цена на мод договорная. 
      Связаться со мной можете по ссылке во вконтактах группы, либо на форуме.
      Продаётся самая последняя версия мода - 2.2.3
    • Игорь5878
      By Игорь5878
      Оригинальный RakNet ONLINE
      Просмотр файла Продаётся оригинальный игровой мод проекта RakNet Role Play
      В моде присутствует множество уникальных систем например пару примеров: уникальная система крафта оружия/патронов, система чердаков, автосалонов.
      В продажу мода входит: Группа ВК проекта - vk.com/raknet_official Свободная группа - vk.com/raknet_fr
      Сайт/форум проекта - raknetrp.ru
      Цена на мод договорная. 
      Связаться со мной можете по ссылке во вконтактах группы, либо на форуме.
      Продаётся самая последняя версия мода - 2.2.3
      Добавил Игорь5878 Добавлено 19.04.2021 Категория Моды Автор Angel_  
    • odosenok
      By odosenok
      Описание системы.
      Система полета камерой представляет собой возможность перемещаться в пространстве игры по всем осям (X, Y, Z) путем нажатия кнопок на клавиатуре.
       
      Подключение системы.
      1. Система написана в отдельном файле - include. Вам необходимо скачать этот файл и добавить в папку, находящейся в следующей директории:
      "..\pawno\include" 2. Затем Вам следует открыть свой игровой мод и в начале, после всех инклудов, дописать следующую строку:
      #include <fly>  
      Работа с системой.
      В систему полета камерой включены две функции:
      1.
      SetPlayerFlyStatus(playerid, status = 2) /* playerid - ID игрока, которого Вы хотите "отправить" в режим полета status - режим полета* * предусмотрено три режима полета: CAMERA_MODE_NONE (0) - выключить режим полета, CAMERA_MODE_FLY (1) - включить режим полета, CAMERA_MODE_REVERSE (2) - сменить режим на реверсивный */ 2. 
      IsPlayerFlying(playerid) /* playerid - ID игрока, пребывание в состоянии полета которого Вы хотите проверить *данная функция возвращает: CAMERA_MODE_NONE (0), если игрок не находится в состоянии полета, CAMERA_MODE_FLY (1), если игрок находится в состоянии полета */ При помощи данных функций Вы можете управлять пребыванием игрока в режиме полета, а также получать информацию о том, "летает" ли игрок в тот или иной момент.
       
      Особенности системы.
      Системой полета предусмотрено, что игрок, выходящий из режима полета, появится именно там, где вышел. Так, если Вы покидаете режим полета, пребывая в озере, то появление игрока будет именно в этом озере.
       
      Пример использования.
      CMD:fly(playerid, params[]) { static const MSG_USE_CMD[] = !"» Usage the command: /fly [mode 0-2]"; if(isnull(params)) return SendClientMessage(playerid, -1, MSG_USE_CMD) & 0; new mode; if(sscanf(params, "d", mode)) return SendClientMessage(playerid, -1, MSG_USE_CMD) & 0; else if(!(0 <= mode <= 2)) return SendClientMessage(playerid, -1, MSG_USE_CMD) & 0; SetPlayerFlyStatus(playerid, mode); return 1; } CMD:checkfly(playerid, params[]) { static const MSG_USE_CMD[] = !"» Usage the command: /checkfly [playerid]"; if(isnull(params)) return SendClientMessage(playerid, -1, MSG_USE_CMD) & 0; new id; if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, MSG_USE_CMD) & 0; else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, !"The player is not connected") & 0; static const status_fly[][] = { !"The player is not flying", !"The player is flying" }; SendClientMessage(playerid, -1, status_fly[IsPlayerFlying(id)]); return 1 } Авторское право.
      Функции для получения позиции для перемещения камеры, само перемещение вырезаны из разработки Norck.
      В свою очередь я, @odosenok, лишь преобразовал данный код, создал более удобный интерфейс.
       
      fly.inc