Вопросы

SendFo RP
Освоившийся

Привет, мне друг добавил команду для создания домов, и я решил её проверить!

Создаю дом всё как надо, /addhouse [ТИП] [СТОИМОСТЬ] [ЦЕНА АРЕНДЫ]

Создаю так: /addhouse (2-Высокий) 50000000 100000

Дом создался под ID 0

 

Я пере захожу, создаю ещё один дом, а он начал создаваться опять с 0 ID.

Посмотрел то место где я создавал дом, того дома нет он просто переместился!

Купил дом который создал, потом вышел из него, а вышел в другом месте где создавал дом в первый раз!

Что делать кто знает?

 

Спойлер

CMD:addhouse(playerid, params[])
{
    if(GetPlayerAdminEx(playerid) != 6) return 1;

    extract params -> new type, price, rent_price; else return SendClientMessage(playerid, 0xCECECEFF, "Используйте: /addhouse [тип] [стоимость] [цена аренды]");

    new fmt_text[300];

    if(!(0 <= type <= sizeof g_house_type - 1))
    {
        SendClientMessage(playerid, 0x999999FF, "Типы домов:");

        for(new i; i < sizeof g_house_type; i ++)
        {
            format(fmt_text, sizeof fmt_text, "%d. %s", i, GetHouseTypeInfo(i, HT_NAME));

            SendClientMessage(playerid, 0xCECECEFF, fmt_text);
        }

        return 1;
    }

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

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

    new Cache: result,
        idx = g_house_loaded;

    GetPlayerPos(playerid, g_house[idx][H_POS_X], g_house[idx][H_POS_Y], g_house[idx][H_POS_Z]);

    new buffer[2];

    buffer[0] = Get2DCity(GetHouseData(idx, H_POS_X), GetHouseData(idx, H_POS_Y));
    buffer[1] = Get2DZone(GetHouseData(idx, H_POS_X), GetHouseData(idx, H_POS_Y));

    SetHouseData(idx, H_CITY,            buffer[0]);
    SetHouseData(idx, H_ZONE,            buffer[1]);

    SetHouseData(idx, H_PRICE,            price);
    SetHouseData(idx, H_RENT_PRICE,        rent_price);
    SetHouseData(idx, H_TYPE,            type);

    SetHouseData(idx, H_ENTRACE,        -1);

    format
    (
        fmt_text, sizeof fmt_text,
        "INSERT INTO houses \
        (city, zone, type, price, rent_price, x, y, z)\
        VALUES ('%d', '%d', '%d', '%d', '%f', '%f', '%f', '%f')",
        GetHouseData(idx, H_CITY),
        GetHouseData(idx, H_ZONE),
        type, price, rent_price,
        GetHouseData(idx, H_POS_X),
        GetHouseData(idx, H_POS_Y),
        GetHouseData(idx, H_POS_Z)
    );

    result = mysql_query(mysql, fmt_text, true);

    SetHouseData(idx, H_SQL_ID,         cache_insert_id());

    cache_delete(result);

    g_house_loaded ++;

    UpdateHouse(idx);

    format(fmt_text, sizeof fmt_text, "[A] %s[%d] создал дом ¹%d (%s / %s)", GetPlayerNameEx(playerid), playerid, idx, GetCityName(GetHouseData(idx, H_CITY)), GetZoneName(GetHouseData(idx, H_ZONE)));

    SendMessageToAdmins(fmt_text, 0x66CC33FF);

    SendClientMessage(playerid, 0x3399FFFF, "Используйте {FFFF00}/setexitpos и /setcarpos{3399FF}, чтобы завершить создание дома");

    return 1;
}

 

CMD:setexitpos(playerid, params[])
{
    if(GetPlayerAdminEx(playerid) != 6) return 1;

    extract params -> new house_id; else return SendClientMessage(playerid, 0xCECECEFF, "Используйте: /setexitpos [id дома]");

    if(!(0 <= house_id <= g_house_loaded - 1)) return SendClientMessage(playerid, 0x999999FF, "Данного дома не существует на сервере");

    GetPlayerPos(playerid, g_house[house_id][H_EXIT_POS_X], g_house[house_id][H_EXIT_POS_Y], g_house[house_id][H_EXIT_POS_Z]);
    GetPlayerFacingAngle(playerid, g_house[house_id][H_EXIT_ANGLE]);

    new fmt_text[144];

    format
    (
        fmt_text, sizeof fmt_text,
        "UPDATE houses SET exit_x='%f', exit_y='%f', exit_z='%f', exit_angle='%f' WHERE id=%d",
        GetHouseData(house_id, H_EXIT_POS_X),
        GetHouseData(house_id, H_EXIT_POS_Y),
        GetHouseData(house_id, H_EXIT_POS_Z),
        GetHouseData(house_id, H_EXIT_ANGLE),
        GetHouseData(house_id, H_SQL_ID)
    );

    mysql_query(mysql, fmt_text, false);

    format(fmt_text, sizeof fmt_text, "Вы успешно изменили координаты выхода у дома №%d", house_id);

    SendClientMessage(playerid, 0x66CC33FF, fmt_text);

    return 1;
}

 

CMD:setcarpos(playerid, params[])
{
    if(GetPlayerAdminEx(playerid) != 6) return 1;

    extract params -> new house_id; else return SendClientMessage(playerid, 0xCECECEFF, "Используйте: /setcarpos [id дома]");

    if(!(0 <= house_id <= g_house_loaded - 1)) return SendClientMessage(playerid, 0x999999FF, "Данного дома не существует на сервере");

    GetPlayerPos(playerid, g_house[house_id][H_CAR_POS_X], g_house[house_id][H_CAR_POS_Y], g_house[house_id][H_CAR_POS_Z]);
    GetPlayerFacingAngle(playerid, g_house[house_id][H_CAR_ANGLE]);

    new fmt_text[144];

    format
    (
        fmt_text, sizeof fmt_text,
        "UPDATE houses SET car_x='%f', car_y='%f', car_z='%f', car_angle='%f' WHERE id=%d",
        GetHouseData(house_id, H_CAR_POS_X),
        GetHouseData(house_id, H_CAR_POS_Y),
        GetHouseData(house_id, H_CAR_POS_Z),
        GetHouseData(house_id, H_CAR_ANGLE),
        GetHouseData(house_id, H_SQL_ID)
    );

    mysql_query(mysql, fmt_text, false);

    format(fmt_text, sizeof fmt_text, "Вы успешно изменили координаты спавна авто у дома №%d", house_id);

    SendClientMessage(playerid, 0x66CC33FF, fmt_text);

    return 1;
}

 

Отредактировано пользователем SendFo RP

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


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

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

  • 0
danya_white
Завсегдатый

Приветствую, возможно у вас не идет сохранение в базу данных, mysql.log файл покажите.

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


Ссылка на сообщение
  • 0
danya_white
Завсегдатый

Когда вы создали дом, в базе данных он появился, в таблице я так понимаю `houses`?

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


Ссылка на сообщение
  • 0
SendFo RP
Освоившийся
1 час назад, danya_white сказал:

Когда вы создали дом, в базе данных он появился, в таблице я так понимаю `houses`?

Да

 

Только что, SendFo RP сказал:

Да

 

Когда начинаешь создавать с самого начала создаются дома поп порядку 0.1.2.3 и т.д.

Но когда пере заходишь и начинаешь продолжать расстановку домов, то всё начинается с самого начала опять с 0 ид

а те дома просто переносятся даже если он купленый

 

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


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

@SendFo RP В базе запись появляется после того, как дом создан? 

Если да, то нужно смотреть код загрузки домов, с ним что-то не то скорее всего. 

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


Ссылка на сообщение
  • 0
SendFo RP
Освоившийся
Только что, DEST сказал:

@SendFo RP В базе запись появляется после того, как дом создан? 

Если да, то нужно смотреть код загрузки домов, с ним что-то не то скорее всего. 

Я создал дом, он появился в бд.

потом пере захожу, всё как надо работает.

 

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


Ссылка на сообщение
  • 0
SendFo RP
Освоившийся
Только что, danya_white сказал:

@SendFo RPТак в чем проблема тогда?

я создал пару домов, они шли по порядку с 0 ид по 3 ид.

Пере захожу что бы до расставлять дома, а они почему то с 0 ид опять начали создаваться.

купил дом под 0 ид для примера, пере зашёл создал дом, а он опять под 0 ид и перенесся мой дом в другое место, а место выхода осталось там где у его указал при первом создании дома!

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


Ссылка на сообщение
  • 0
SendFo RP
Освоившийся
1 минуту назад, danya_white сказал:

Код загрузки домов покажи

где их найти? Я не знаю просто

 

 

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


Ссылка на сообщение
  • 0
SendFo RP
Освоившийся
1 минуту назад, danya_white сказал:

LoadHouses должно быть, возможно у вас как-то по другому

Спойлер

    LoadHouses();
    LoadHousesRenters();

 

public: LoadHouses()
{
    new idx;
    new query[85], buffer[2];
    new Cache: result;

    result = mysql_query(mysql, "SELECT * FROM `houses`", true);

    for(idx = 0; idx < MAX_HOUSES; idx++)
    {
        cache_get_value_name(idx, "h_owner", g_house[idx][H_OWNER_NAME]);

        cache_get_value_name(idx, "name", g_house[idx][H_NAME]);

        cache_get_value_name_int(idx, "city", GetHouseData(idx, H_CITY));
        cache_get_value_name_int(idx, "zone", GetHouseData(idx, H_ZONE));
        cache_get_value_name_int(idx, "improvements", GetHouseData(idx, H_IMPROVEMENTS));

        cache_get_value_name_int(idx, "rent_time", GetHouseData(idx, H_RENT_DATE));
        cache_get_value_name_int(idx, "price", GetHouseData(idx, H_PRICE));
        cache_get_value_name_int(idx, "rent_price", GetHouseData(idx, H_RENT_PRICE));
        cache_get_value_name_int(idx, "type", GetHouseData(idx, H_TYPE));
        cache_get_value_name_int(idx, "lock", bool: GetHouseData(idx, H_LOCK_STATUS));

        cache_get_value_name_float(idx, "x", GetHouseData(idx, H_POS_X));
        cache_get_value_name_float(idx, "y", GetHouseData(idx, H_POS_Y));
        cache_get_value_name_float(idx, "z", GetHouseData(idx, H_POS_Z));

        cache_get_value_name_float(idx, "exit_x", GetHouseData(idx, H_EXIT_POS_X));
        cache_get_value_name_float(idx, "exit_y", GetHouseData(idx, H_EXIT_POS_Y));
        cache_get_value_name_float(idx, "exit_z", GetHouseData(idx, H_EXIT_POS_Z));
        cache_get_value_name_float(idx, "exit_angle", GetHouseData(idx, H_EXIT_ANGLE));

        cache_get_value_name_float(idx, "car_x", GetHouseData(idx, H_CAR_POS_X));
        cache_get_value_name_float(idx, "car_y", GetHouseData(idx, H_CAR_POS_Y));
        cache_get_value_name_float(idx, "car_z", GetHouseData(idx, H_CAR_POS_Z));
        cache_get_value_name_float(idx, "car_angle", GetHouseData(idx, H_CAR_ANGLE));

        cache_get_value_name_float(idx, "helicopter_x", GetHouseData(idx, H_HELI_POS_X));
        cache_get_value_name_float(idx, "helicopter_y", GetHouseData(idx, H_HELI_POS_Y));
        cache_get_value_name_float(idx, "helicopter_z", GetHouseData(idx, H_HELI_POS_Z));
        cache_get_value_name_float(idx, "helicopter_angle", GetHouseData(idx, H_HELI_ANGLE));

        cache_get_value_name_float(idx, "store_x", GetHouseData(idx, H_STORE_X));
        cache_get_value_name_float(idx, "store_y", GetHouseData(idx, H_STORE_Y));
        cache_get_value_name_float(idx, "store_z", GetHouseData(idx, H_STORE_Z));

        cache_get_value_name_int(idx, "store_metall", GetHouseData(idx, H_STORE_METALL));
        cache_get_value_name_int(idx, "store_drugs", GetHouseData(idx, H_STORE_DRUGS));
        cache_get_value_name_int(idx, "store_weapon", GetHouseData(idx, H_STORE_WEAPON));
        cache_get_value_name_int(idx, "store_ammo", GetHouseData(idx, H_STORE_AMMO));
        cache_get_value_name_int(idx, "store_skin", GetHouseData(idx, H_STORE_SKIN));

        // -------------------------
        SetHouseData(idx, H_STORE_LABEL, Text3D:-1);

        buffer[0] = GetHouseData(idx, H_TYPE);
        if(!strlen(GetHouseData(idx, H_NAME)))
            format(g_house[idx][H_NAME], 20, GetHouseTypeInfo(buffer[0], HT_NAME), 0);

        if(GetHouseData(idx, H_CITY) == -1 || GetHouseData(idx, H_ZONE) == -1)
        {
            buffer[0] = Get2DCity(GetHouseData(idx, H_POS_X), GetHouseData(idx, H_POS_Y));
            buffer[1] = Get2DZone(GetHouseData(idx, H_POS_X), GetHouseData(idx, H_POS_Y));

            SetHouseData(idx, H_CITY, buffer[0]);
            SetHouseData(idx, H_ZONE, buffer[1]);

            mysql_format(mysql, query, sizeof query, "UPDATE houses SET city=%d,zone=%d WHERE id=%d", buffer[0], buffer[1], idx);
            mysql_tquery(mysql, query);
        }

        if(!IsHouseOwned(idx))
        {
            SetHouseData(idx, H_IMPROVEMENTS,     0);
            SetHouseData(idx, H_LOCK_STATUS,     false);
        }
        UpdateHouse(idx);

        HouseHealthInit(idx);
        HouseStoreInit(idx);
    }

    cache_delete(result);

    printf("[Houses]: Домов загружено: %d", MAX_HOUSES);
}

public: LoadHousesRenters()
{
    new house_id;
    new room_id;
    new rent_time;
    new time;
    new owner_name[MAX_PLAYER_NAME];

    new Cache: result, rows;

    result = mysql_query(mysql, "SELECT * FROM houses_renters", true);
    rows = cache_num_rows();

    for(new i; i < MAX_HOUSES; i++) for(new x; x < MAX_HOUSE_ROOMS; x++) format(GetHouseRenterInfo(i, x, HR_OWNER_NAME), MAX_PLAYER_NAME, "null");

    for(new idx; idx < rows; idx ++)
    {
        cache_get_value_name(idx, "owner_name", owner_name);

        cache_get_value_name_int(idx, "house_id", house_id);
        cache_get_value_name_int(idx, "room_id", room_id);
        cache_get_value_name_int(idx, "rent_time", rent_time);
        cache_get_value_name_int(idx, "time", time);

        if(!strlen(owner_name))
            owner_name[0] = '\1';

        HouseRenterInit(owner_name, house_id, room_id, rent_time, time);
    }

    cache_delete(result);

    printf("[Houses]: Арендаторов загружено: %d", rows);
}

 

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


Ссылка на сообщение
  • 0
danya_white
Завсегдатый

public: LoadHouses()
{
    new idx;
    new query[85], buffer[2];
    new Cache: result;

    result = mysql_query(mysql, "SELECT * FROM `houses`", true);

    for(idx = 0; idx < MAX_HOUSES; idx++)
    {

        cache_get_value_name_int(idx, "house_id", house_id);
        cache_get_value_name(idx, "h_owner", g_house[idx][H_OWNER_NAME]);

        cache_get_value_name(idx, "name", g_house[idx][H_NAME]);

        cache_get_value_name_int(idx, "city", GetHouseData(idx, H_CITY));
        cache_get_value_name_int(idx, "zone", GetHouseData(idx, H_ZONE));
        cache_get_value_name_int(idx, "improvements", GetHouseData(idx, H_IMPROVEMENTS));

        cache_get_value_name_int(idx, "rent_time", GetHouseData(idx, H_RENT_DATE));
        cache_get_value_name_int(idx, "price", GetHouseData(idx, H_PRICE));
        cache_get_value_name_int(idx, "rent_price", GetHouseData(idx, H_RENT_PRICE));
        cache_get_value_name_int(idx, "type", GetHouseData(idx, H_TYPE));
        cache_get_value_name_int(idx, "lock", bool: GetHouseData(idx, H_LOCK_STATUS));

        cache_get_value_name_float(idx, "x", GetHouseData(idx, H_POS_X));
        cache_get_value_name_float(idx, "y", GetHouseData(idx, H_POS_Y));
        cache_get_value_name_float(idx, "z", GetHouseData(idx, H_POS_Z));

        cache_get_value_name_float(idx, "exit_x", GetHouseData(idx, H_EXIT_POS_X));
        cache_get_value_name_float(idx, "exit_y", GetHouseData(idx, H_EXIT_POS_Y));
        cache_get_value_name_float(idx, "exit_z", GetHouseData(idx, H_EXIT_POS_Z));
        cache_get_value_name_float(idx, "exit_angle", GetHouseData(idx, H_EXIT_ANGLE));

        cache_get_value_name_float(idx, "car_x", GetHouseData(idx, H_CAR_POS_X));
        cache_get_value_name_float(idx, "car_y", GetHouseData(idx, H_CAR_POS_Y));
        cache_get_value_name_float(idx, "car_z", GetHouseData(idx, H_CAR_POS_Z));
        cache_get_value_name_float(idx, "car_angle", GetHouseData(idx, H_CAR_ANGLE));

        cache_get_value_name_float(idx, "helicopter_x", GetHouseData(idx, H_HELI_POS_X));
        cache_get_value_name_float(idx, "helicopter_y", GetHouseData(idx, H_HELI_POS_Y));
        cache_get_value_name_float(idx, "helicopter_z", GetHouseData(idx, H_HELI_POS_Z));
        cache_get_value_name_float(idx, "helicopter_angle", GetHouseData(idx, H_HELI_ANGLE));

        cache_get_value_name_float(idx, "store_x", GetHouseData(idx, H_STORE_X));
        cache_get_value_name_float(idx, "store_y", GetHouseData(idx, H_STORE_Y));
        cache_get_value_name_float(idx, "store_z", GetHouseData(idx, H_STORE_Z));

        cache_get_value_name_int(idx, "store_metall", GetHouseData(idx, H_STORE_METALL));
        cache_get_value_name_int(idx, "store_drugs", GetHouseData(idx, H_STORE_DRUGS));
        cache_get_value_name_int(idx, "store_weapon", GetHouseData(idx, H_STORE_WEAPON));
        cache_get_value_name_int(idx, "store_ammo", GetHouseData(idx, H_STORE_AMMO));
        cache_get_value_name_int(idx, "store_skin", GetHouseData(idx, H_STORE_SKIN));

        // -------------------------
        SetHouseData(idx, H_STORE_LABEL, Text3D:-1);

        buffer[0] = GetHouseData(idx, H_TYPE);
        if(!strlen(GetHouseData(idx, H_NAME)))
            format(g_house[idx][H_NAME], 20, GetHouseTypeInfo(buffer[0], HT_NAME), 0);

        if(GetHouseData(idx, H_CITY) == -1 || GetHouseData(idx, H_ZONE) == -1)
        {
            buffer[0] = Get2DCity(GetHouseData(idx, H_POS_X), GetHouseData(idx, H_POS_Y));
            buffer[1] = Get2DZone(GetHouseData(idx, H_POS_X), GetHouseData(idx, H_POS_Y));

            SetHouseData(idx, H_CITY, buffer[0]);
            SetHouseData(idx, H_ZONE, buffer[1]);

            mysql_format(mysql, query, sizeof query, "UPDATE houses SET city=%d,zone=%d WHERE id=%d", buffer[0], buffer[1], idx);
            mysql_tquery(mysql, query);
        }

        if(!IsHouseOwned(idx))
        {
            SetHouseData(idx, H_IMPROVEMENTS,     0);
            SetHouseData(idx, H_LOCK_STATUS,     false);
        }
        UpdateHouse(idx);

        HouseHealthInit(idx);
        HouseStoreInit(idx);
    }

    cache_delete(result);

    printf("[Houses]: Домов загружено: %d", MAX_HOUSES);
}

Попробуйте так. 

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


Ссылка на сообщение
  • 0
SendFo RP
Освоившийся
1 минуту назад, danya_white сказал:

 


public: LoadHouses()
{
    new idx;
    new query[85], buffer[2];
    new Cache: result;

    result = mysql_query(mysql, "SELECT * FROM `houses`", true);

    for(idx = 0; idx < MAX_HOUSES; idx++)
    {

        cache_get_value_name_int(idx, "house_id", house_id);
        cache_get_value_name(idx, "h_owner", g_house[idx][H_OWNER_NAME]);

        cache_get_value_name(idx, "name", g_house[idx][H_NAME]);

        cache_get_value_name_int(idx, "city", GetHouseData(idx, H_CITY));
        cache_get_value_name_int(idx, "zone", GetHouseData(idx, H_ZONE));
        cache_get_value_name_int(idx, "improvements", GetHouseData(idx, H_IMPROVEMENTS));

        cache_get_value_name_int(idx, "rent_time", GetHouseData(idx, H_RENT_DATE));
        cache_get_value_name_int(idx, "price", GetHouseData(idx, H_PRICE));
        cache_get_value_name_int(idx, "rent_price", GetHouseData(idx, H_RENT_PRICE));
        cache_get_value_name_int(idx, "type", GetHouseData(idx, H_TYPE));
        cache_get_value_name_int(idx, "lock", bool: GetHouseData(idx, H_LOCK_STATUS));

        cache_get_value_name_float(idx, "x", GetHouseData(idx, H_POS_X));
        cache_get_value_name_float(idx, "y", GetHouseData(idx, H_POS_Y));
        cache_get_value_name_float(idx, "z", GetHouseData(idx, H_POS_Z));

        cache_get_value_name_float(idx, "exit_x", GetHouseData(idx, H_EXIT_POS_X));
        cache_get_value_name_float(idx, "exit_y", GetHouseData(idx, H_EXIT_POS_Y));
        cache_get_value_name_float(idx, "exit_z", GetHouseData(idx, H_EXIT_POS_Z));
        cache_get_value_name_float(idx, "exit_angle", GetHouseData(idx, H_EXIT_ANGLE));

        cache_get_value_name_float(idx, "car_x", GetHouseData(idx, H_CAR_POS_X));
        cache_get_value_name_float(idx, "car_y", GetHouseData(idx, H_CAR_POS_Y));
        cache_get_value_name_float(idx, "car_z", GetHouseData(idx, H_CAR_POS_Z));
        cache_get_value_name_float(idx, "car_angle", GetHouseData(idx, H_CAR_ANGLE));

        cache_get_value_name_float(idx, "helicopter_x", GetHouseData(idx, H_HELI_POS_X));
        cache_get_value_name_float(idx, "helicopter_y", GetHouseData(idx, H_HELI_POS_Y));
        cache_get_value_name_float(idx, "helicopter_z", GetHouseData(idx, H_HELI_POS_Z));
        cache_get_value_name_float(idx, "helicopter_angle", GetHouseData(idx, H_HELI_ANGLE));

        cache_get_value_name_float(idx, "store_x", GetHouseData(idx, H_STORE_X));
        cache_get_value_name_float(idx, "store_y", GetHouseData(idx, H_STORE_Y));
        cache_get_value_name_float(idx, "store_z", GetHouseData(idx, H_STORE_Z));

        cache_get_value_name_int(idx, "store_metall", GetHouseData(idx, H_STORE_METALL));
        cache_get_value_name_int(idx, "store_drugs", GetHouseData(idx, H_STORE_DRUGS));
        cache_get_value_name_int(idx, "store_weapon", GetHouseData(idx, H_STORE_WEAPON));
        cache_get_value_name_int(idx, "store_ammo", GetHouseData(idx, H_STORE_AMMO));
        cache_get_value_name_int(idx, "store_skin", GetHouseData(idx, H_STORE_SKIN));

        // -------------------------
        SetHouseData(idx, H_STORE_LABEL, Text3D:-1);

        buffer[0] = GetHouseData(idx, H_TYPE);
        if(!strlen(GetHouseData(idx, H_NAME)))
            format(g_house[idx][H_NAME], 20, GetHouseTypeInfo(buffer[0], HT_NAME), 0);

        if(GetHouseData(idx, H_CITY) == -1 || GetHouseData(idx, H_ZONE) == -1)
        {
            buffer[0] = Get2DCity(GetHouseData(idx, H_POS_X), GetHouseData(idx, H_POS_Y));
            buffer[1] = Get2DZone(GetHouseData(idx, H_POS_X), GetHouseData(idx, H_POS_Y));

            SetHouseData(idx, H_CITY, buffer[0]);
            SetHouseData(idx, H_ZONE, buffer[1]);

            mysql_format(mysql, query, sizeof query, "UPDATE houses SET city=%d,zone=%d WHERE id=%d", buffer[0], buffer[1], idx);
            mysql_tquery(mysql, query);
        }

        if(!IsHouseOwned(idx))
        {
            SetHouseData(idx, H_IMPROVEMENTS,     0);
            SetHouseData(idx, H_LOCK_STATUS,     false);
        }
        UpdateHouse(idx);

        HouseHealthInit(idx);
        HouseStoreInit(idx);
    }

    cache_delete(result);

    printf("[Houses]: Домов загружено: %d", MAX_HOUSES);
}

Попробуйте так. 

Сейчас попробую

 

4 минуты назад, danya_white сказал:

 


public: LoadHouses()
{
    new idx;
    new query[85], buffer[2];
    new Cache: result;

    result = mysql_query(mysql, "SELECT * FROM `houses`", true);

    for(idx = 0; idx < MAX_HOUSES; idx++)
    {

        cache_get_value_name_int(idx, "house_id", house_id);
        cache_get_value_name(idx, "h_owner", g_house[idx][H_OWNER_NAME]);

        cache_get_value_name(idx, "name", g_house[idx][H_NAME]);

        cache_get_value_name_int(idx, "city", GetHouseData(idx, H_CITY));
        cache_get_value_name_int(idx, "zone", GetHouseData(idx, H_ZONE));
        cache_get_value_name_int(idx, "improvements", GetHouseData(idx, H_IMPROVEMENTS));

        cache_get_value_name_int(idx, "rent_time", GetHouseData(idx, H_RENT_DATE));
        cache_get_value_name_int(idx, "price", GetHouseData(idx, H_PRICE));
        cache_get_value_name_int(idx, "rent_price", GetHouseData(idx, H_RENT_PRICE));
        cache_get_value_name_int(idx, "type", GetHouseData(idx, H_TYPE));
        cache_get_value_name_int(idx, "lock", bool: GetHouseData(idx, H_LOCK_STATUS));

        cache_get_value_name_float(idx, "x", GetHouseData(idx, H_POS_X));
        cache_get_value_name_float(idx, "y", GetHouseData(idx, H_POS_Y));
        cache_get_value_name_float(idx, "z", GetHouseData(idx, H_POS_Z));

        cache_get_value_name_float(idx, "exit_x", GetHouseData(idx, H_EXIT_POS_X));
        cache_get_value_name_float(idx, "exit_y", GetHouseData(idx, H_EXIT_POS_Y));
        cache_get_value_name_float(idx, "exit_z", GetHouseData(idx, H_EXIT_POS_Z));
        cache_get_value_name_float(idx, "exit_angle", GetHouseData(idx, H_EXIT_ANGLE));

        cache_get_value_name_float(idx, "car_x", GetHouseData(idx, H_CAR_POS_X));
        cache_get_value_name_float(idx, "car_y", GetHouseData(idx, H_CAR_POS_Y));
        cache_get_value_name_float(idx, "car_z", GetHouseData(idx, H_CAR_POS_Z));
        cache_get_value_name_float(idx, "car_angle", GetHouseData(idx, H_CAR_ANGLE));

        cache_get_value_name_float(idx, "helicopter_x", GetHouseData(idx, H_HELI_POS_X));
        cache_get_value_name_float(idx, "helicopter_y", GetHouseData(idx, H_HELI_POS_Y));
        cache_get_value_name_float(idx, "helicopter_z", GetHouseData(idx, H_HELI_POS_Z));
        cache_get_value_name_float(idx, "helicopter_angle", GetHouseData(idx, H_HELI_ANGLE));

        cache_get_value_name_float(idx, "store_x", GetHouseData(idx, H_STORE_X));
        cache_get_value_name_float(idx, "store_y", GetHouseData(idx, H_STORE_Y));
        cache_get_value_name_float(idx, "store_z", GetHouseData(idx, H_STORE_Z));

        cache_get_value_name_int(idx, "store_metall", GetHouseData(idx, H_STORE_METALL));
        cache_get_value_name_int(idx, "store_drugs", GetHouseData(idx, H_STORE_DRUGS));
        cache_get_value_name_int(idx, "store_weapon", GetHouseData(idx, H_STORE_WEAPON));
        cache_get_value_name_int(idx, "store_ammo", GetHouseData(idx, H_STORE_AMMO));
        cache_get_value_name_int(idx, "store_skin", GetHouseData(idx, H_STORE_SKIN));

        // -------------------------
        SetHouseData(idx, H_STORE_LABEL, Text3D:-1);

        buffer[0] = GetHouseData(idx, H_TYPE);
        if(!strlen(GetHouseData(idx, H_NAME)))
            format(g_house[idx][H_NAME], 20, GetHouseTypeInfo(buffer[0], HT_NAME), 0);

        if(GetHouseData(idx, H_CITY) == -1 || GetHouseData(idx, H_ZONE) == -1)
        {
            buffer[0] = Get2DCity(GetHouseData(idx, H_POS_X), GetHouseData(idx, H_POS_Y));
            buffer[1] = Get2DZone(GetHouseData(idx, H_POS_X), GetHouseData(idx, H_POS_Y));

            SetHouseData(idx, H_CITY, buffer[0]);
            SetHouseData(idx, H_ZONE, buffer[1]);

            mysql_format(mysql, query, sizeof query, "UPDATE houses SET city=%d,zone=%d WHERE id=%d", buffer[0], buffer[1], idx);
            mysql_tquery(mysql, query);
        }

        if(!IsHouseOwned(idx))
        {
            SetHouseData(idx, H_IMPROVEMENTS,     0);
            SetHouseData(idx, H_LOCK_STATUS,     false);
        }
        UpdateHouse(idx);

        HouseHealthInit(idx);
        HouseStoreInit(idx);
    }

    cache_delete(result);

    printf("[Houses]: Домов загружено: %d", MAX_HOUSES);
}

Попробуйте так. 

Спойлер

C:\Users\admin\Desktop\Friendly rp (Nikitos)\gamemodes\new.pwn(25954) : error 017: undefined symbol "house_id"
Pawn compiler 3.10.20150531              Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
 

 

Строка 

cache_get_value_name_int(idx, "house_id", house_id);

 

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


Ссылка на сообщение
  • 0
SendFo RP
Освоившийся
16 минут назад, danya_white сказал:

 


public: LoadHouses()
{
    new idx;
    new query[85], buffer[2];
    new Cache: result;

    result = mysql_query(mysql, "SELECT * FROM `houses`", true);

    for(idx = 0; idx < MAX_HOUSES; idx++)
    {

        cache_get_value_name_int(idx, "house_id", house_id);
        cache_get_value_name(idx, "h_owner", g_house[idx][H_OWNER_NAME]);

        cache_get_value_name(idx, "name", g_house[idx][H_NAME]);

        cache_get_value_name_int(idx, "city", GetHouseData(idx, H_CITY));
        cache_get_value_name_int(idx, "zone", GetHouseData(idx, H_ZONE));
        cache_get_value_name_int(idx, "improvements", GetHouseData(idx, H_IMPROVEMENTS));

        cache_get_value_name_int(idx, "rent_time", GetHouseData(idx, H_RENT_DATE));
        cache_get_value_name_int(idx, "price", GetHouseData(idx, H_PRICE));
        cache_get_value_name_int(idx, "rent_price", GetHouseData(idx, H_RENT_PRICE));
        cache_get_value_name_int(idx, "type", GetHouseData(idx, H_TYPE));
        cache_get_value_name_int(idx, "lock", bool: GetHouseData(idx, H_LOCK_STATUS));

        cache_get_value_name_float(idx, "x", GetHouseData(idx, H_POS_X));
        cache_get_value_name_float(idx, "y", GetHouseData(idx, H_POS_Y));
        cache_get_value_name_float(idx, "z", GetHouseData(idx, H_POS_Z));

        cache_get_value_name_float(idx, "exit_x", GetHouseData(idx, H_EXIT_POS_X));
        cache_get_value_name_float(idx, "exit_y", GetHouseData(idx, H_EXIT_POS_Y));
        cache_get_value_name_float(idx, "exit_z", GetHouseData(idx, H_EXIT_POS_Z));
        cache_get_value_name_float(idx, "exit_angle", GetHouseData(idx, H_EXIT_ANGLE));

        cache_get_value_name_float(idx, "car_x", GetHouseData(idx, H_CAR_POS_X));
        cache_get_value_name_float(idx, "car_y", GetHouseData(idx, H_CAR_POS_Y));
        cache_get_value_name_float(idx, "car_z", GetHouseData(idx, H_CAR_POS_Z));
        cache_get_value_name_float(idx, "car_angle", GetHouseData(idx, H_CAR_ANGLE));

        cache_get_value_name_float(idx, "helicopter_x", GetHouseData(idx, H_HELI_POS_X));
        cache_get_value_name_float(idx, "helicopter_y", GetHouseData(idx, H_HELI_POS_Y));
        cache_get_value_name_float(idx, "helicopter_z", GetHouseData(idx, H_HELI_POS_Z));
        cache_get_value_name_float(idx, "helicopter_angle", GetHouseData(idx, H_HELI_ANGLE));

        cache_get_value_name_float(idx, "store_x", GetHouseData(idx, H_STORE_X));
        cache_get_value_name_float(idx, "store_y", GetHouseData(idx, H_STORE_Y));
        cache_get_value_name_float(idx, "store_z", GetHouseData(idx, H_STORE_Z));

        cache_get_value_name_int(idx, "store_metall", GetHouseData(idx, H_STORE_METALL));
        cache_get_value_name_int(idx, "store_drugs", GetHouseData(idx, H_STORE_DRUGS));
        cache_get_value_name_int(idx, "store_weapon", GetHouseData(idx, H_STORE_WEAPON));
        cache_get_value_name_int(idx, "store_ammo", GetHouseData(idx, H_STORE_AMMO));
        cache_get_value_name_int(idx, "store_skin", GetHouseData(idx, H_STORE_SKIN));

        // -------------------------
        SetHouseData(idx, H_STORE_LABEL, Text3D:-1);

        buffer[0] = GetHouseData(idx, H_TYPE);
        if(!strlen(GetHouseData(idx, H_NAME)))
            format(g_house[idx][H_NAME], 20, GetHouseTypeInfo(buffer[0], HT_NAME), 0);

        if(GetHouseData(idx, H_CITY) == -1 || GetHouseData(idx, H_ZONE) == -1)
        {
            buffer[0] = Get2DCity(GetHouseData(idx, H_POS_X), GetHouseData(idx, H_POS_Y));
            buffer[1] = Get2DZone(GetHouseData(idx, H_POS_X), GetHouseData(idx, H_POS_Y));

            SetHouseData(idx, H_CITY, buffer[0]);
            SetHouseData(idx, H_ZONE, buffer[1]);

            mysql_format(mysql, query, sizeof query, "UPDATE houses SET city=%d,zone=%d WHERE id=%d", buffer[0], buffer[1], idx);
            mysql_tquery(mysql, query);
        }

        if(!IsHouseOwned(idx))
        {
            SetHouseData(idx, H_IMPROVEMENTS,     0);
            SetHouseData(idx, H_LOCK_STATUS,     false);
        }
        UpdateHouse(idx);

        HouseHealthInit(idx);
        HouseStoreInit(idx);
    }

    cache_delete(result);

    printf("[Houses]: Домов загружено: %d", MAX_HOUSES);
}

Попробуйте так. 

удаляю строку еррора нет

 

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


Ссылка на сообщение
  • 0
SendFo RP
Освоившийся
29 минут назад, danya_white сказал:

H_OWNER_ID есть у вас переменная?
enum E_HOTEL_STRUCT
{
	H_SQL_ID,
	H_OWNER_ID,
	H_RENT_DATE,
	bool: H_STATUS,
	H_OWNER_NAME[21]
};

 

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


Ссылка на сообщение
Гость
Эта тема закрыта для публикации ответов.
  • Последние посетители   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. Помогите пожалуйста