shape1
shape2
shape3
shape4
shape7
shape8

Не сохраняются созданные бизнесы


snegovik

Новичок
Пользователь
31.03.2021
1
0
0
Здравствуйте!

Проблема в том, что при создании бизнеса (/addbiz) он не сохраняется

mod - Radmir RPПомогите пожалуйста!


Спойлер

Код:
CMD:addbiz(playerid, params[])
{
	if(GetPlayerAdminEx(playerid) < 6) return 1;
	new type, newtype,price,rent_price;
	if(sscanf(params, "iii", type,price,rent_price)) return SendClientMessage(playerid, COLOR_GOLD, "Используйте:{"#cW"} /addbiz [тип] [стоимость] [цена аренды]");

	new fmt_text[512];

	if(!(1 <= type <= 11))
		return SendClientMessage(playerid, COLOR_WHITE, "Типы бизнесов: 1-24/7, 2-Клуб, 3-Управление стат., 4-Риэлторск., 5-Одежда, 6-Отель, 7-Авторынок, 8-Казино, 9-Сотовый салон, 11- rent cars");

	if(type == 7)
	{
	     if(sscanf(params, "iiii", type,newtype,price,rent_price)) return SendClientMessage(playerid, COLOR_GOLD, "Используйте:{"#cW"} /addbiz [тип] [тип автосалона] [стоимость] [цена аренды]");
	}

	if(price < 1) return SendClientMessage(playerid, 0xFF6600FF, "Стоимость бизнеса не может быть меньше 1");

	if(rent_price < 1) return SendClientMessage(playerid, 0xFF6600FF, "Стоимость аренды не может быть меньше 1");

	new Cache: result,
		idx = g_business_loaded;

	new name_biz[24];
	switch(type)
	{
	    case 1: name_biz = "Магазин 24/7";
	    case 2: name_biz = "Клуб";
	    case 3: name_biz = "Управление статистики";
	    case 4: name_biz = "Риэлторское агенство";
	    case 5: name_biz = "Магазин Одежды";
	    case 6: name_biz = "Гостиница";
	    case 7: name_biz = "Автосалон";
	    case 8: name_biz = "Казино";
	    case 9: name_biz = "Сотовый салон";
	    case 10: name_biz = "Аренда авто";
	}
	switch(newtype)
	{
	    case 1:name_biz = "Автосалон 'Эконом'";
		case 2:name_biz = "Автосалон 'Средний'";
		case 3:name_biz = "Автосалон 'Премиум'";
	}
	new int_biz;
	switch(type)
	{
	    case 1: int_biz = 0;
	    case 2: int_biz = 1;
	    case 3: int_biz = 2;
	    case 4: int_biz = 3;
	    case 5: int_biz = 4;
	    case 6: int_biz = 5;
	    case 7: int_biz = 6;
	    case 8: int_biz = 7;
	    case 9: int_biz = 8;
	    case 10: int_biz = 9;
	}

	GetPlayerPos(playerid, g_business[idx][B_POS_X], g_business[idx][B_POS_Y], g_business[idx][B_POS_Z]);

	new buffer[2];

	buffer[0] = Get2DCity(GetBusinessData(idx, B_POS_X), GetBusinessData(idx, B_POS_Y));
	buffer[1] = Get2DZone(GetBusinessData(idx, B_POS_X), GetBusinessData(idx, B_POS_Y));

	SetBusinessData(idx, B_CITY,			buffer[0]);
	SetBusinessData(idx, B_ZONE,			buffer[1]);

	SetBusinessData(idx, B_PRICE,			price);
	SetBusinessData(idx, B_RENT_PRICE,		rent_price);
	SetBusinessData(idx, B_TYPE,			type);
	SetBusinessData(idx, B_NAME,			name_biz);
	SetBusinessData(idx, B_TYPEAV,          newtype);



	format
	(
		fmt_text, sizeof fmt_text,
		"INSERT INTO business \
		(name, city, zone, type, price, rent_price, x, y, z, interior, typeav)\
		VALUES ('%s','%d', '%d', '%d', '%d', '%d', '%f', '%f', '%f', '%d', '%d')",
		name_biz,
		GetBusinessData(idx, B_CITY),
		GetBusinessData(idx, B_ZONE),
		type, price, rent_price,
		GetBusinessData(idx, B_POS_X),
		GetBusinessData(idx, B_POS_Y),
		GetBusinessData(idx, B_POS_Z),
		int_biz,
		GetBusinessData(idx, B_TYPEAV)

	);

	result = mysql_query(mysql, fmt_text, true);

	SetBusinessData(idx, B_SQL_ID, cache_insert_id());

	SetBusinessData(idx, B_INTERIOR, int_biz);
/*	if(type == 6)
	{
	    for(new i; i < MAX_ROOMS; i++)
	    {
	        format
			(
				fmt_text, sizeof fmt_text,
				"INSERT INTO gostinitsa \
				(gost,x,y,z)\
				VALUES ('%d','%f','%f','%f')",
				GetBusinessData(idx, B_SQL_ID),
				gostinitsa[i][B_POS_X],
				gostinitsa[i][B_POS_Y],
				gostinitsa[i][B_POS_Z]

			);
			result = mysql_query(mysql, fmt_text, true);
		 	CreatePickup(19132, 23, gostinitsa[i][B_POS_X], gostinitsa[i][B_POS_Y], gostinitsa[i][B_POS_Z], 0, PICKUP_ACTION_TYPE_BIZ_ROOM)
		}
	}*/

	cache_delete(result);

	g_business_loaded ++;

    SetBusinessData(idx, B_ENTER_PICKUP, CreatePickup(19132, 23, GetBusinessData(idx, B_POS_X), GetBusinessData(idx, B_POS_Y), GetBusinessData(idx, B_POS_Z), 0, PICKUP_ACTION_TYPE_BIZ_ENTER, idx));

    SetBusinessData(idx, B_LABEL, CreateDynamic3DTextLabel(GetBusinessData(idx, B_NAME), 0xFFFF00FF, GetBusinessData(idx, B_POS_X), GetBusinessData(idx, B_POS_Y), GetBusinessData(idx, B_POS_Z) + 1.0, 6.50));

	UpdateBusinessLabel(idx);

	format(fmt_text, sizeof fmt_text, "[A] %s [%d] создал бизнес №%d (%s / %s)", GetPlayerNameEx(playerid), playerid, idx, GetCityName(GetBusinessData(idx, B_CITY)), GetZoneName(GetBusinessData(idx, B_ZONE)));

	SendMessageToAdmins(fmt_text, COLOR_GREY);

	SendClientMessage(playerid, COLOR_WHITE, "{"#cGold"}Используйте: {"#cW"}/bsetexitpos, чтобы завершить создание бизнеса");

	return 1;
}
 ​








 
Последнее редактирование модератором:

Alexander_Batrakov

Новичок
Пользователь
13.09.2019
255
2
0
0
25
Игрок
Код:
format(fmt_text, sizeof fmt_text,
"INSERT INTO `business` \
(`name`, `city`, `zone`, `type`, `price`, `rent_price`, `x`, `y`, `z`, `interior`, `typeav`) \
VALUES ('%s','%d', '%d', '%d', '%d', '%d', '%f', '%f', '%f', '%d', '%d')",
name_biz,
GetBusinessData(idx, B_CITY),
GetBusinessData(idx, B_ZONE),
type, price, rent_price,
GetBusinessData(idx, B_POS_X),
GetBusinessData(idx, B_POS_Y),
GetBusinessData(idx, B_POS_Z),
int_biz,
GetBusinessData(idx, B_TYPEAV));