Доступ к архиву

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

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

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

Создание /bpanel для RLS.

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

Mike_Warren

Новичок
[/COLOR]Управление бизнесом в диалоге.
Автор:Неизвестно.
Вырезал Mike_Warren из мода Rezone-Rp 5 версии

Это вставляете в команды сервера.

PHP:
else if (strcmp("/bpanel", cmdtext, true) == 0)
	{
		if(gPlayerLogged[playerid] == 1)return ShowPlayerDialog(playerid, 38, DIALOG_STYLE_LIST, "Управление бизнесом", "1. Продать бизнес\n2. {00ff00}Открыть{ffffff}/{ff0000}Закрыть {ffffff}бизнес\n3. Статистика бизнеса\n4. Снять деньги с бизнеса\n5. Изменить цену за вход/бензин", "Выбрать", "Отмена");
		return true;
	}
А это в паблик public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) (Свои Case меняете на мои)

PHP:
case 38:
    {
	new sendername[MAX_PLAYER_NAME];
	if(response)
	{
		switch(listitem)
		{
			case 0:
			{
		    if(IsPlayerConnected(playerid))
			{
				GetPlayerName(playerid, playername, sizeof(playername));
				if(PlayerInfo[playerid][pPbiskey] == 255) return SendClientMessage(playerid, COLOR_GREY, "У вас нет бизенса!");
	  			if(PlayerInfo[playerid][pPbiskey] >= 100 && strcmp(playername, SBizzInfo[PlayerInfo[playerid][pPbiskey]-100][sbOwner], true) == 0)
				{
				    new bouse = PlayerInfo[playerid][pPbiskey]-100;
				    if (!PlayerToPoint(3, playerid,SBizzInfo[bouse][sbEntranceX], SBizzInfo[bouse][sbEntranceY], SBizzInfo[bouse][sbEntranceZ])) return SendClientMessage(playerid, COLOR_GREY, "Вы не у своего бизнеса!");
					PlayerInfo[playerid][pBank] +=SBizzInfo[bouse][sbTill];
					SBizzInfo[bouse][sbLocked] = 1;
					SBizzInfo[bouse][sbOwned] = 0;
					SBizzInfo[bouse][sbPriceProd] = 0;
					SBizzInfo[bouse][sbProducts] = 0;
					GetPlayerName(playerid, sendername, sizeof(sendername));
					strmid(SBizzInfo[bouse][sbOwner], "The State", 0, strlen("The State"), 255);
				//	PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
					SendClientMessage(playerid, COLOR_YELLOW2, "Бизнес успешно продан");
					format(string, sizeof(string), "- Прибыль с продажи бизнеса: %d $", SBizzInfo[bouse][sbTill]);
					SendClientMessage(playerid, COLOR_WHITE, string);
					format(string, sizeof(string), "- Новый счёт в банке: %d $", PlayerInfo[playerid][pBank]);
					SendClientMessage(playerid, COLOR_WHITE, string);
					SendClientMessage(playerid, COLOR_YELLOW2, "Бизнес успешно продан");
					SBizzInfo[bouse][sbTill] = 0;
					PlayerInfo[playerid][pPbiskey] = 255;
					format(string, sizeof(string), "Цена: %d\nБизнес продаётся",SBizzInfo[bouse][sbBuyPrice]);
					Update3DTextLabelText(SBizzInfo[bouse][sbLabel], COLOR_YELLOW, string);
					OnPropUpdate();
					OnPlayerUpdateRL(playerid);
					return true;
					}
	            	if(strcmp(playername, BizzInfo[PlayerInfo[playerid][pPbiskey]][bOwner], true) == 0)
					{
					new bouse = PlayerInfo[playerid][pPbiskey];
					if (!PlayerToPoint(3, playerid,BizzInfo[bouse][bEntranceX], BizzInfo[bouse][bEntranceY], BizzInfo[bouse][bEntranceZ])) return SendClientMessage(playerid, COLOR_GREY, "Вы не у своего бизнеса!");
					BizzInfo[bouse][bLocked] = 1;
					BizzInfo[bouse][bOwned] = 0;
					BizzInfo[bouse][bProducts] = 0;
					GetPlayerName(playerid, sendername, sizeof(sendername));
					strmid(BizzInfo[bouse][bOwner], "The State", 0, strlen("The State"), 255);
					strmid(BizzInfo[bouse][bExtortion], "No-one", 0, strlen("No-one"), 255);
					PlayerInfo[playerid][pBank] +=BizzInfo[bouse][bTill] / 2;
					PlayerInfo[playerid][pBank] +=BizzInfo[bouse][b2Till];
					PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
	  		 		SendClientMessage(playerid, COLOR_YELLOW2, "Бизнес успешно продан");
					format(string, sizeof(string), "- Прибыль с продажи бизнеса: %d $", BizzInfo[bouse][bTill]);
					SendClientMessage(playerid, COLOR_WHITE, string);
					format(string, sizeof(string), "- Новый счёт в банке: %d $", PlayerInfo[playerid][pBank]);
					SendClientMessage(playerid, COLOR_WHITE, string);
					SendClientMessage(playerid, COLOR_YELLOW2, "Бизнес успешно продан");
					BizzInfo[bouse][bTill] = 0;
					BizzInfo[bouse][b2Till] = 0;
					PlayerInfo[playerid][pPbiskey] = 255;
					format(string, sizeof(string), "Цена: %d\nБизнес продаётся",BizzInfo[bouse][bBuyPrice]);
					Update3DTextLabelText(BizzInfo[bouse][bLabel], COLOR_YELLOW, string);
					OnPropUpdate();
					OnPlayerUpdateRL(playerid);
					return true;
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "У вас нет бизнеса!");
				}
			}
			return true;
		}
		case 1:
		{
	    if(IsPlayerConnected(playerid))
	    {
	    for(new i = 0; i < sizeof(BizzInfo); i++)
			{
				if (PlayerToPoint(3, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]) || PlayerToPoint(3, playerid,BizzInfo[i][bExitX], BizzInfo[i][bExitY], BizzInfo[i][bExitZ]))
				{
					if(PlayerInfo[playerid][pPbiskey] == i || PlayerInfo[playerid][pMember] == 2 && PlayerInfo[playerid][pRank] >= 5)
					{
						if(BizzInfo[i][bLocked] == 1)
						{
							BizzInfo[i][bLocked] = 0;
							SendClientMessage(playerid, COLOR_GRAD1, "Вы открыли бизнес");
							PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
							return true;
						}
						if(BizzInfo[i][bLocked] == 0)
						{
							BizzInfo[i][bLocked] = 1;
							SendClientMessage(playerid, COLOR_GRAD1, "Вы закрыли бизнес");
							PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
							return true;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GRAD1, "Бизнес закрыт");
						return true;
					}
				}
			}
			for(new i = 0; i < sizeof(SBizzInfo); i++)
			{
				if (PlayerToPoint(3, playerid,SBizzInfo[i][sbEntranceX], SBizzInfo[i][sbEntranceY], SBizzInfo[i][sbEntranceZ]))
				{
					if(PlayerInfo[playerid][pPbiskey] == i+100)
					{
						if(SBizzInfo[i][sbLocked] == 1)
						{
							SBizzInfo[i][sbLocked] = 0;
							SendClientMessage(playerid, COLOR_WHITE, "Вы открыли свой бизнес!");
							PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
							return true;
						}
						if(SBizzInfo[i][sbLocked] == 0)
						{
							SBizzInfo[i][sbLocked] = 1;
							SendClientMessage(playerid, COLOR_WHITE, "Вы закрыли свой бизнес!");
							PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
							return true;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_WHITE, "Данный бизнес закрыт!");
						return true;
					}
				}
			}
		}
	}
 	                case 2:
		{
	    if(IsPlayerConnected(playerid))
		{
			new bouse = PlayerInfo[playerid][pPbiskey];
			if(bouse == 255)  return SendClientMessage(playerid, COLOR_GREY, "У вас нет бизнеса!");
			if (bouse >= 100)
			{

				PrintSBizInfo(playerid,bouse-100);
			}
			else
			{
			PrintBizInfo(playerid,bouse);
			}
		}
		return true;
	}
                   	case 3: ShowPlayerDialog(playerid, 2020, DIALOG_STYLE_INPUT, "Сумма", "Введите количество", "Снять", "Отмена");
      			 	case 4: ShowPlayerDialog(playerid, 39, DIALOG_STYLE_INPUT, "Сумма", "Введите количество", "Установить", "Отмена");
		       		}
}
}


case 2020:
	{
	    if(IsPlayerConnected(playerid))
		{
			new bouse = PlayerInfo[playerid][pPbiskey];
			if (bouse == 255)  return SendClientMessage(playerid, COLOR_GRAD2, "У вас нет бизнеса!");
			new cashdeposit = strval(inputtext);
			if (bouse >= 100)
			{
				if(cashdeposit > SBizzInfo[bouse-100][sbTill] || cashdeposit < 1)  return SendClientMessage(playerid, COLOR_GRAD2, "На счету бизнеса нет столько денег!");
			}
			else
			{
				if (cashdeposit > BizzInfo[bouse][bTill] || cashdeposit < 1)  return SendClientMessage(playerid, COLOR_GRAD2, "На счету бизнеса нет столько денег!");
			}
			if (bouse >= 100)
			{
				if(!PlayerToPoint(100, playerid,SBizzInfo[bouse-100][sbEntranceX],SBizzInfo[bouse-100][sbEntranceY],SBizzInfo[bouse-100][sbEntranceZ]))
				{
					SendClientMessage(playerid, COLOR_WHITE, "Вы слишком далеко от вашего бизнеса!");
					return true;
				}
				else
				{
					PlayerInfo[playerid][pCash] +=cashdeposit;
					SBizzInfo[bouse-100][sbTill] -= cashdeposit;
					format(string, sizeof(string), "Вы сняли %d $ на счёт вашего бизнеса. Остаток: %d $ ", cashdeposit,SBizzInfo[bouse-100][sbTill]);
					SendClientMessage(playerid, 0x6495EDFF, string);
					return true;
				}
			}
			else
			{
				if (!PlayerToPoint(100, playerid,BizzInfo[bouse][bExitX],BizzInfo[bouse][bExitY],BizzInfo[bouse][bExitZ]))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "Вам нужно быть внутри бизнеса!");
					return true;
				}
				else
				{
					PlayerInfo[playerid][pCash] +=cashdeposit;
					BizzInfo[bouse][bTill] -= cashdeposit;
					format(string, sizeof(string), "Вы сняли %d $ со счёта бизнеса. Остаток: %d $", cashdeposit,BizzInfo[bouse][bTill]);
					SendClientMessage(playerid, 0x6495EDFF, string);
					return true;
				}
			}
		}
		return true;
	}
case 39:
	{
	    if(IsPlayerConnected(playerid))
		{
			new bouse = PlayerInfo[playerid][pPbiskey];
			if (bouse == 255) return SendClientMessage(playerid, COLOR_GRAD2, "У вас нет бизнеса!");
			if (bouse >= 100)
			{
   				SBizzInfo[bouse-100][sbPriceProd] = strval(inputtext);
				format(string,sizeof(string), "%s\nВладелец:\n %s\n Цена бензина %d", SBizzInfo[bouse-100][sbMessage], SBizzInfo[bouse-100][sbOwner],SBizzInfo[bouse-100][sbPriceProd]);
				Update3DTextLabelText(SBizzInfo[bouse-100][sbLabel], TEAM_GROVE_COLOR, string);
				format(string, sizeof(string), "Цена бензина: установлена на %d $", SBizzInfo[bouse-100][sbPriceProd]);
				OnPropUpdate();
			}
   else
			{
				BizzInfo[bouse][bEntranceCost] = strval(inputtext);
				format(string,sizeof(string), "%s\nВладелец:\n %s", BizzInfo[bouse][bMessage], BizzInfo[bouse][bOwner]);
				Update3DTextLabelText(BizzInfo[bouse][bLabel], TEAM_GROVE_COLOR, string);
                format(string, sizeof(string), "Плата за вход %d $.", BizzInfo[bouse][bEntranceCost]);
 				OnPropUpdate();
			}
			SendClientMessage(playerid, COLOR_WHITE, string);
			OnPropUpdate();
		}
		return true;
	}
Вот. Если буду ошибки пишите. +Тут измененная статистика бизнеса.(Более красивая). +Если не жалко):df:
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу