Доступ к готовым решениям

Переход в группу "Пользователь"

300.00 ₽
Одноразовый платёж
Быстрый переход в группу "Пользователи", без надобности написания постов и ожидания.

Покупка дает возможность:
Быть полноправным участником форума
Нормальное копирование кода
Создавать темы
Скачивать файлы
Доступ к архиву Pawno-Info

Мануал Действие при наводке мышки на Textdraw

Статус
В этой теме нельзя размещать новые ответы.

Zhenia

Компетентный
Во первых, качаем плагин: System Control

Создаем глобальные переменные:


PHP:
new bool:SelectWeaponK[MAX_PLAYERS];
new bool:WeaponCreate[MAX_PLAYERS][2]; 
new TimerWeapon[MAX_PLAYERS];
new PlayerText: InfoWeapon[MAX_PLAYERS][6];
Поставим таймер, для нахождения курсора:

PHP:
SelectWeaponK[playerid][0] = true; - нужен, для вхождения в цикл, по умолчанию всегда ставьте false
TimerWeapon[playerid] = SetTimerEx("CheckCursor", 500, true, "i", playerid); - таймер
Создаем паблик

PHP:
Forward CheckCursor(playerid);
public CheckCursor(playerid)
{
  if(SelectWeaponK[playerid][0] == true) -- проверка на вхождения в цикл
	{
		new x, y;
		GetCursorPos(x,y); -- получаем координаты мыши
		for(new x1 = 348; x1 < 439; x1++)
		{
			for(new y1 = 278; y1 < 303; y1++)
			{
				if(x == x1 && y == y1)
				{
					if(WeaponCreate[playerid][0] == false) -- если у нас нет тексдрава, то создадим
					{
						
						for(new l = 1; l < 5; l++)
						{
							PlayerTextDrawDestroy(playerid, InfoWeapon[playerid][l]);
						}

						InfoWeapon[playerid][1] = CreatePlayerTextDraw(playerid, 429.000000, 129.937500, "LD_SPAC:white");
						PlayerTextDrawLetterSize(playerid, InfoWeapon[playerid][1], 0.000000, 0.000000);
						PlayerTextDrawTextSize(playerid, InfoWeapon[playerid][1], 130.500000, 57.312500);
						PlayerTextDrawAlignment(playerid, InfoWeapon[playerid][1], 1);
						PlayerTextDrawColor(playerid, InfoWeapon[playerid][1], -1);
						PlayerTextDrawBackgroundColor(playerid, InfoWeapon[playerid][1], 0x00000000); 
						PlayerTextDrawUseBox(playerid, InfoWeapon[playerid][1], true);
						PlayerTextDrawBoxColor(playerid, InfoWeapon[playerid][1], 0);
						PlayerTextDrawSetShadow(playerid, InfoWeapon[playerid][1], 0);
						PlayerTextDrawSetOutline(playerid, InfoWeapon[playerid][1], 0);
						PlayerTextDrawFont(playerid, InfoWeapon[playerid][1], 5);
						PlayerTextDrawSetPreviewModel(playerid, InfoWeapon[playerid][1], 349);
						PlayerTextDrawSetPreviewRot(playerid, InfoWeapon[playerid][1], 0.000000, 0.000000, 0.000000, 2.000000);

						InfoWeapon[playerid][2] = CreatePlayerTextDraw(playerid, 418.000000, 170.000000, "DMG: 100");
						PlayerTextDrawLetterSize(playerid, InfoWeapon[playerid][2], 0.355000, 1.079375);
						PlayerTextDrawAlignment(playerid, InfoWeapon[playerid][2], 1);
						PlayerTextDrawColor(playerid, InfoWeapon[playerid][2], -1);
						PlayerTextDrawSetShadow(playerid, InfoWeapon[playerid][2], 0);
						PlayerTextDrawSetOutline(playerid, InfoWeapon[playerid][2], 1);
						PlayerTextDrawBackgroundColor(playerid, InfoWeapon[playerid][2], 51);
						PlayerTextDrawFont(playerid, InfoWeapon[playerid][2], 1);
						PlayerTextDrawSetProportional(playerid, InfoWeapon[playerid][2], 1);

						InfoWeapon[playerid][3] = CreatePlayerTextDraw(playerid, 418.000000, 182.000000, "Skill: 999");
						PlayerTextDrawLetterSize(playerid, InfoWeapon[playerid][3], 0.355000, 1.079375);
						PlayerTextDrawAlignment(playerid, InfoWeapon[playerid][3], 1);
						PlayerTextDrawColor(playerid, InfoWeapon[playerid][3], -1);
						PlayerTextDrawSetShadow(playerid, InfoWeapon[playerid][3], 0);
						PlayerTextDrawSetOutline(playerid, InfoWeapon[playerid][3], 1);
						PlayerTextDrawBackgroundColor(playerid, InfoWeapon[playerid][3], 51);
						PlayerTextDrawFont(playerid, InfoWeapon[playerid][3], 1);
						PlayerTextDrawSetProportional(playerid, InfoWeapon[playerid][3], 1);

						InfoWeapon[playerid][4] = CreatePlayerTextDraw(playerid, 418.000000, 195.000000, "Ammo: 360");
						PlayerTextDrawLetterSize(playerid, InfoWeapon[playerid][4], 0.355000, 1.079375);
						PlayerTextDrawAlignment(playerid, InfoWeapon[playerid][4], 1);
						PlayerTextDrawColor(playerid, InfoWeapon[playerid][4], -1);
						PlayerTextDrawSetShadow(playerid, InfoWeapon[playerid][4], 0);
						PlayerTextDrawSetOutline(playerid, InfoWeapon[playerid][4], 1);
						PlayerTextDrawBackgroundColor(playerid, InfoWeapon[playerid][4], 51);
						PlayerTextDrawFont(playerid, InfoWeapon[playerid][4], 1);
						PlayerTextDrawSetProportional(playerid, InfoWeapon[playerid][4], 1);
						for(new l = 1; l < 5; l++)
						{
							PlayerTextDrawShow(playerid, InfoWeapon[playerid][l]);
						}
						for(new i = 0; i < 2; i++)
						{
							if(i == 0) WeaponCreate[playerid][i] = true; -- запретим повторное создание
							WeaponCreate[playerid][i] = false;
						}
					}
				}
			}
		}
		for(new x1 = 346; x1 < 493; x1++)
		{
			for(new y1 = 329; y1 < 350; y1++)
			{
				if(x == x1 && y == y1)
				{
					if(WeaponCreate[playerid][1] == false)
					{
						
						for(new l = 1; l < 5; l++)
						{
							PlayerTextDrawDestroy(playerid, InfoWeapon[playerid][l]);
						}

						InfoWeapon[playerid][1] = CreatePlayerTextDraw(playerid, 429.000000, 129.937500, "LD_SPAC:white");
						PlayerTextDrawLetterSize(playerid, InfoWeapon[playerid][1], 0.000000, 0.000000);
						PlayerTextDrawTextSize(playerid, InfoWeapon[playerid][1], 130.500000, 57.312500);
						PlayerTextDrawAlignment(playerid, InfoWeapon[playerid][1], 1);
						PlayerTextDrawColor(playerid, InfoWeapon[playerid][1], -1);
						PlayerTextDrawBackgroundColor(playerid, InfoWeapon[playerid][1], 0x00000000); 
						PlayerTextDrawUseBox(playerid, InfoWeapon[playerid][1], true);
						PlayerTextDrawBoxColor(playerid, InfoWeapon[playerid][1], 0);
						PlayerTextDrawSetShadow(playerid, InfoWeapon[playerid][1], 0);
						PlayerTextDrawSetOutline(playerid, InfoWeapon[playerid][1], 0);
						PlayerTextDrawFont(playerid, InfoWeapon[playerid][1], 5);
						PlayerTextDrawSetPreviewModel(playerid, InfoWeapon[playerid][1], 357);
						PlayerTextDrawSetPreviewRot(playerid, InfoWeapon[playerid][1], 0.000000, 0.000000, 0.000000, 2.000000);

						InfoWeapon[playerid][2] = CreatePlayerTextDraw(playerid, 418.000000, 170.000000, "DMG: 100");
						PlayerTextDrawLetterSize(playerid, InfoWeapon[playerid][2], 0.355000, 1.079375);
						PlayerTextDrawAlignment(playerid, InfoWeapon[playerid][2], 1);
						PlayerTextDrawColor(playerid, InfoWeapon[playerid][2], -1);
						PlayerTextDrawSetShadow(playerid, InfoWeapon[playerid][2], 0);
						PlayerTextDrawSetOutline(playerid, InfoWeapon[playerid][2], 1);
						PlayerTextDrawBackgroundColor(playerid, InfoWeapon[playerid][2], 51);
						PlayerTextDrawFont(playerid, InfoWeapon[playerid][2], 1);
						PlayerTextDrawSetProportional(playerid, InfoWeapon[playerid][2], 1);

						InfoWeapon[playerid][3] = CreatePlayerTextDraw(playerid, 418.000000, 182.000000, "Skill: 999");
						PlayerTextDrawLetterSize(playerid, InfoWeapon[playerid][3], 0.355000, 1.079375);
						PlayerTextDrawAlignment(playerid, InfoWeapon[playerid][3], 1);
						PlayerTextDrawColor(playerid, InfoWeapon[playerid][3], -1);
						PlayerTextDrawSetShadow(playerid, InfoWeapon[playerid][3], 0);
						PlayerTextDrawSetOutline(playerid, InfoWeapon[playerid][3], 1);
						PlayerTextDrawBackgroundColor(playerid, InfoWeapon[playerid][3], 51);
						PlayerTextDrawFont(playerid, InfoWeapon[playerid][3], 1);
						PlayerTextDrawSetProportional(playerid, InfoWeapon[playerid][3], 1);

						InfoWeapon[playerid][4] = CreatePlayerTextDraw(playerid, 418.000000, 195.000000, "Ammo: 360");
						PlayerTextDrawLetterSize(playerid, InfoWeapon[playerid][4], 0.355000, 1.079375);
						PlayerTextDrawAlignment(playerid, InfoWeapon[playerid][4], 1);
						PlayerTextDrawColor(playerid, InfoWeapon[playerid][4], -1);
						PlayerTextDrawSetShadow(playerid, InfoWeapon[playerid][4], 0);
						PlayerTextDrawSetOutline(playerid, InfoWeapon[playerid][4], 1);
						PlayerTextDrawBackgroundColor(playerid, InfoWeapon[playerid][4], 51);
						PlayerTextDrawFont(playerid, InfoWeapon[playerid][4], 1);
						PlayerTextDrawSetProportional(playerid, InfoWeapon[playerid][4], 1);
						for(new l = 1; l < 5; l++)
						{
							PlayerTextDrawShow(playerid, InfoWeapon[playerid][l]);
						}
						for(new i = 0; i < 2; i++)
						{
							if(i == 1) WeaponCreate[playerid][i] = true;
							WeaponCreate[playerid][i] = false;
						}
					}
				}
			}
		}
  true;
}

Чтобы выйти с цикла, вам нужно удалить таймер и запретить вход в цикл
PHP:
KillTimer(TimerWeapon[playerid]);
SelectWeaponK[playerid][0] = false;
Внимание, работает по пикселям и если вы поставите координаты на разрешении экрана игры 1024*768, то данная функция будет работать только в данном режиме, если игрок зайдет с большим режимом экрана игры, то все координаты сползутся

 
Последнее редактирование:
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу