Question

Когда покупаю личное авто в автосалоне ,то все они отображаются в /fixcar. Но после перезахода не сервер в /fixcar показывает максимум 5 авто. Как это исправить?

 

Команда fixcar:

Спойлер

cmd:fixcar( playerid )
{
        if ( Iter_Count(player_vehicles[playerid]) == 0 ) return SendClientMessage ( playerid, col_gray,""c_orange_red"* "c_grey"У Вас нет транспорта или он находится на штрафстоянке." ) ;
        new line_str [ 128 ] ;


        format ( global_string, sizeof ( global_string ), ""c_server"Выберите транспорт для буксировки:\t\n" ) ;
        foreach(new veh_id:player_vehicles[playerid])
        {
                format ( line_str, sizeof(line_str), ""c_grey"- "c_white"%s\t"c_grey"%s\n", vehicle_name [ GetVehicleModel ( veh_id ) - 400 ], veh_info [ veh_id - 1 ] [ v_plate ] ) ;
                strcat ( global_string, line_str ) ;
        }
        show_dialog(playerid, d_fixcar, DIALOG_STYLE_TABLIST, ""c_server"Аварийная служба", global_string, "Выбрать""Закрыть");
        return 1;
}

 

 

case d_fixcar:

Спойлер


           case d_fixcar:
        {
            if (!response) return 1;
            if (p_info[playerid][money] < 350return SendClientMessage(playerid, col_gray, ""c_orange_red"* "c_grey"У Вас недостаточно средств.");
            if (listitem == 0)
            {
                new line_str[78];


                format(global_string, sizeof(global_string), ""c_server"Выберите транспорт для буксировки:\t\n");
                foreach(new veh_id:player_vehicles[playerid])
                {
                    format(line_str, 78""c_grey"- "c_white"%s\t"c_grey"%s\n", vehicle_name[GetVehicleModel(veh_id) - 400], veh_info[veh_id - 1][v_plate]);
                    strcat(global_string, line_str);
                }
                show_dialog(playerid, d_fixcar, DIALOG_STYLE_TABLIST_HEADERS, ""c_server"Аварийная служба""Транспорт""Выбрать""Закрыть", global_string);
                return 1;
            }
            new _step = 1, carid;
            foreach(new _v_id:player_vehicles[playerid])
            {
                if (_step == listitem)
                {
                    carid = _v_id;
                }
                _step++;
            }
            foreach(new i: logged_players)
            {
                if (IsPlayerInVehicle(i, carid))
                {
                    return SendClientMessage(playerid, col_gray, ""c_orange_red"* "c_grey"Транспорт используется.");
                }
                if (is_player_in_boat[i] == carid) return SendClientMessage(playerid, col_gray, ""c_orange_red"* "c_grey"Нельзя отбуксировать яхту, внутри которой находитесь Вы или другие люди.");

            }
            SetVehicleToRespawn(carid);
            give_money(playerid, -350);

            insert_money_log(playerid, INVALID_PLAYER_ID, -350"/fixcar");
            GameTextForPlayer(playerid, "~r~-350$"20001);
            SendClientMessage(playerid, col_gray, "* Транспорт отремонтирован и отбуксирован к месту стоянки.");
        }

 

 

 

 

 

Код покупки авто:

Спойлер

case d_buy_autosalon:
                {
                        if(!response) return 1;

                        new ts_vehicle = GetPVarInt(playerid, !"tshop_car"), ts_type = GetPVarInt(playerid, !"tshop_type") - 1, ts_list = GetPVarInt(playerid, !"tshop_list"), ts_id = GetPVarInt(playerid, !"tshop_id") - 1;
                        switch(listitem)
                        {
                                case 0:
                                {
                                        if(p_info[playerid][money] < GetModelPrice(t_shop_models[ts_list][ts_type])) return SendClientMessage(playerid, col_white, !""scm_error"У Вас недостаточно средств.");
                                        if(get_player_veh_count(playerid) >= p_info[playerid][max_veh]) return SendClientMessage(playerid, col_white, !""scm_error"Для начала нужно продать одно из имещихся транспортных средств.");

                                        new ts_spawn_slot = random(5);
                                        if(ts_id < 0) ts_id = 0;
                                        new     veh_id = CreateVehicle(t_shop_models[ts_list][ts_type], t_shop_respawn[ts_id][ts_spawn_slot][0], t_shop_respawn[ts_id][ts_spawn_slot][1], t_shop_respawn[ts_id][ts_spawn_slot][2], t_shop_respawn[ts_id][ts_spawn_slot][3], veh_info[ts_vehicle - 1][v_color][0], veh_info[ts_vehicle - 1][v_color][1], -1);

                                        veh_info[veh_id - 1][v_model] = GetVehicleModel(veh_id);

                                        new query_string[226];
                                        mysql_format(sql_connection, query_string, sizeof(query_string), "INSERT INTO `users_vehicles`(`v_model`,`v_owner`,`v_color_1`,`v_color_2`,`v_pos_x`,`v_pos_y`,`v_pos_z`,`v_pos_a`,
`v_buydate`) VALUES('%d','%d','%d','%d','%f','%f','%f','
%f',NOW())", t_shop_models[ts_list][ts_type], p_info[playerid][id], veh_info[ts_vehicle - 1][v_color][0], veh_info[ts_vehicle - 1][v_color][1], t_shop_respawn[ts_id][ts_spawn_slot][0], t_shop_respawn[ts_id][ts_spawn_slot][1], t_shop_respawn[ts_id][ts_spawn_slot][2], t_shop_respawn[ts_id][ts_spawn_slot][3]);
                                        mysql_tquery(sql_connection, query_string, "create_vehicle_callback""dd", veh_id, playerid);

                                        give_money(playerid, -GetModelPrice(t_shop_models[ts_list][ts_type]));
                                        insert_money_log(playerid, INVALID_PLAYER_ID, -GetModelPrice(t_shop_models[ts_list][ts_type]), "покупка личного транспорта");

                                        DestroyVehicle(ts_vehicle);

                                        veh_info[veh_id - 1][v_type] = vehicle_type_player;
                                        veh_info[veh_id - 1][v_owner] = p_info[playerid][id];
                                        veh_info[veh_id - 1][v_vehicle] = veh_id;
                                        format(veh_info[veh_id - 1][v_plate], 12"Transit");
                                        veh_info[veh_id - 1][v_pos][0] = t_shop_respawn[ts_id][ts_spawn_slot][0];
                                        veh_info[veh_id - 1][v_pos][1] = t_shop_respawn[ts_id][ts_spawn_slot][1];
                                        veh_info[veh_id - 1][v_pos][2] = t_shop_respawn[ts_id][ts_spawn_slot][2];
                                        veh_info[veh_id - 1][v_pos][3] = t_shop_respawn[ts_id][ts_spawn_slot][3];

                                        veh_info[veh_id - 1][v_fuel] = 100.0;
                                        veh_info[veh_id - 1][v_millage] = 0.0;
                                        veh_info[veh_id - 1][v_fine] = 3;

                                        veh_info[veh_id - 1][v_locked] = true;

                                        new engine, lights, alarm, doors, bonnet, boot, objective;
                                        GetVehicleParamsEx(veh_id, engine, lights, alarm, doors, bonnet, boot, objective);
                                        SetVehicleParamsEx(veh_id, engine, lights, alarm, true, bonnet, boot, objective);

                                        Iter_Add(player_vehicles[playerid], veh_info[veh_id - 1][v_vehicle]);

                                        for(new j = 0; j < 4; j ++)
                                        {
                                                PlayerTextDrawHide(playerid, ptd_tshop[playerid][j]);
                                                PlayerTextDrawDestroy(playerid, ptd_tshop[playerid][j]);
                                                ptd_tshop[playerid][j] = PlayerText: -1;
                                        }

                                        for(new j = 0; j < 20; j ++)
                                        {
                                                TextDrawHideForPlayer(playerid, td_tshop[j]);
                                                TextDrawHideForPlayer(playerid, td_color_tshop[j]);
                                        }

                                        DestroyVehicle(GetPVarInt(playerid, !"tshop_car"));
                                        if(GetPVarInt(playerid, !"tshop_car2") > 0) DestroyVehicle(GetPVarInt(playerid, !"tshop_car2"));

                                        SetPVarInt(playerid, !"tp_area_used"1);
                                        DeletePVar(playerid, !"tshop_id"), DeletePVar(playerid, !"tshop_type"), DeletePVar(playerid, !"tshop_car"), DeletePVar(playerid, !"tshop_car2"), DeletePVar(playerid, !"tshop_list");
                                        CancelSelectTextDraw(playerid);

                                        switch(ts_id)
                                        {
                                                case 0: set_pos(playerid, 547.6648, -1278.897916.9415000);
                                                case 1: set_pos(playerid, -1969.2168294.005435.171983.879000);
                                                case 2: set_pos(playerid, 2200.77911394.184711.0625178.989600);
                                                case 3: set_pos(playerid, 2888.9858, -365.21578.138088.167700);
                                                case 4: set_pos(playerid, -1396.3988, -544.666214.1484216.095800);
                                        }

                                        if(ts_id < 3)
                                        {
                                                SendClientMessage(playerid, col_white, !""scm_info"Вы успешно приобрели транспортное средство.");
                                                SendClientMessage(playerid, col_white, !""scm_info"Оно было доставлено во двор салона.");
                                                SendClientMessage(playerid, col_white, !""scm_info"Необходимо припарковаться в разрешенном месте, чтобы транспорт не был эвакуирован. Используйте: "c_gold"/vpark");

                                                show_dialog(playerid, d_none, DIALOG_STYLE_MSGBOX, !""scm_dialog"Информация", !"\
                                                "c_server"Информация о транспорте:\n\n\
                                                "c_white"Каждое транспортное средство облагается налогами. Оплатить их Вы сможете в банке или в банкомате.\n\
                                                В случае неуплаты налога Вы можете потерять часть своей собственности.\n\n\
                                                По штату курсируют экипажи полиции с эвакуаторами.\n\
                                                В случае парковки в неположенных местах, Ваше транспортное средство будет эвакуировано на штрафстоянку.\n\
                                                Припарковать транспортное средство Вы можете при помощи команды: /vpark\n\
                                                Настоятельно рекомендуем сделать это сразу после покупки транспорта.\n\n\
                                                Каждый игрок может иметь 2 транспортных средства.\n\n\
                                                "c_silver"Вы ознакомились с информацией и желаете продолжить?", !"Закрыть", !"");
                                        }
                                        else if(ts_id == 3) SendClientMessage(playerid, col_white, !""scm_info"Вы успешно приобрели водное транспортное средство.");
                                        else if(ts_id == 4) SendClientMessage(playerid, col_white, !""scm_info"Вы успешно приобрели воздушное транспортное средство. Оно доставлено к ангару.");
                                        return 1;
                                }
                                case 1:
                                {
                                        new family_id = p_info[playerid][family];
                                        if(family_id == 0return SendClientMessage(playerid, col_white, !""scm_error"Вы не состоите в семье.");
                                        if(p_info[playerid][island] == -1return SendClientMessage(playerid, col_white, !""scm_error"У Вашей семьи отсутствует семейный остров.");
                                        if(family_info[family_id - 1][fam_bank] < GetModelPrice(t_shop_models[ts_list][ts_type])) return SendClientMessage(playerid, col_white, !""scm_error"В банке семьи недостаточно средств.");

                                        new ts_spawn_pos = random(12);
                                        if(ts_id < 0) ts_id = 0;

                            new veh_id = CreateVehicle(t_shop_models[ts_list][ts_type], delivery_car_pos_island[p_info[playerid][island] - 1][ts_spawn_pos][0], delivery_car_pos_island[p_info[playerid][island] - 1][ts_spawn_pos][1], delivery_car_pos_island[p_info[playerid][island] - 1][ts_spawn_pos][2], delivery_car_pos_island[p_info[playerid][island] - 1][ts_spawn_pos][3], veh_info[ts_vehicle - 1][v_color][0], veh_info[ts_vehicle - 1][v_color][1], -1);

                                        veh_info[veh_id - 1][v_model] = GetVehicleModel(veh_id);

                            new tquery_string[290];
                            mysql_format(sql_connection, tquery_string, sizeof(tquery_string), "INSERT INTO `family_vehicles` (`sv_model`,`sv_owner`,`sv_pos_x`,`sv_pos_y`,`sv_pos_z`,`sv_pos_a`,`sv_type`) VALUES ('%d','%d','%f','%f','%f','%f','%d')", t_shop_models[ts_list][ts_type], family_id, delivery_car_pos_island[p_info[playerid][island] - 1][ts_spawn_pos][0], delivery_car_pos_island[p_info[playerid][island] - 1][ts_spawn_pos][1], delivery_car_pos_island[p_info[playerid][island] - 1][ts_spawn_pos][2], delivery_car_pos_island[p_info[playerid][island] - 1][ts_spawn_pos][3], vehicle_type_family);
                            mysql_tquery(sql_connection, tquery_string, "create_vehicle_callback""dd", veh_id, playerid);

                            family_info[family_id 1][fam_bank] -= GetModelPrice(t_shop_models[ts_list][ts_type]);

                            new query_string[110];
                            mysql_format(sql_connection, query_string, sizeof(query_string), "UPDATE `family` SET `fam_bank`='%d' WHERE `fam_id`='%d' LIMIT 1", family_info[family_id - 1][fam_bank], family_id);
                            mysql_query(sql_connection, query_string);

                                        DestroyVehicle(ts_vehicle);

                                        veh_info[veh_id - 1][v_type] = vehicle_type_family;
                                        veh_info[veh_id - 1][v_owner] = family_id;
                                        veh_info[veh_id - 1][v_vehicle] = veh_id;
                                        veh_info[veh_id - 1][v_rank] = 1;
                                        format(veh_info[veh_id - 1][v_plate], 12, family_info[family_id - 1][fam_name]);
                                        veh_info[veh_id - 1][v_pos][0] = delivery_car_pos_island[p_info[playerid][island] - 1][ts_spawn_pos][0];
                                        veh_info[veh_id - 1][v_pos][1] = delivery_car_pos_island[p_info[playerid][island] - 1][ts_spawn_pos][1];
                                        veh_info[veh_id - 1][v_pos][2] = delivery_car_pos_island[p_info[playerid][island] - 1][ts_spawn_pos][2];
                                        veh_info[veh_id - 1][v_pos][3] = delivery_car_pos_island[p_info[playerid][island] - 1][ts_spawn_pos][3];

                                        veh_info[veh_id - 1][v_fuel] = 100.0;
                                        veh_info[veh_id - 1][v_millage] = 0.0;
                                        veh_info[veh_id - 1][v_fine] = 3;

                            veh_info[veh_id - 1][v_locked] = false;

                            new engine, lights, alarm, doors, bonnet, boot, objective;
                            GetVehicleParamsEx(veh_id, engine, lights, alarm, doors, bonnet, boot, objective);
                            SetVehicleParamsEx(veh_id, engine, lights, alarm, VEHICLE_PARAMS_OFF, bonnet, boot, objective);

                                        format(query_string, sizeof(query_string), "UPDATE `family_vehicles` SET `sv_plate`='%s' WHERE `sv_id`='%d' LIMIT 1", veh_info[veh_id - 1][v_plate], veh_info[veh_id - 1][v_id]);
                                        mysql_query(sql_connection, query_string);

                                        Iter_Add(family_vehicles[family_id], veh_id);

                                        for(new j = 0; j < 4; j ++)
                                        {
                                                PlayerTextDrawHide(playerid, ptd_tshop[playerid][j]);
                                                PlayerTextDrawDestroy(playerid, ptd_tshop[playerid][j]);
                                                ptd_tshop[playerid][j] = PlayerText: -1;
                                        }

                                        for(new j = 0; j < 20; j ++)
                                        {
                                                TextDrawHideForPlayer(playerid, td_tshop[j]);
                                                TextDrawHideForPlayer(playerid, td_color_tshop[j]);
                                        }

                                        DestroyVehicle(GetPVarInt(playerid, !"tshop_car"));
                                        if(GetPVarInt(playerid, !"tshop_car2") > 0) DestroyVehicle(GetPVarInt(playerid, !"tshop_car2"));

                                        SetPVarInt(playerid, !"tp_area_used"1);
                                        DeletePVar(playerid, !"tshop_id"), DeletePVar(playerid, !"tshop_type"), DeletePVar(playerid, !"tshop_car"), DeletePVar(playerid, !"tshop_car2"), DeletePVar(playerid, !"tshop_list");
                                        CancelSelectTextDraw(playerid);

                                        switch(ts_id)
                                        {
                                                case 0: set_pos(playerid, 547.6648, -1278.897916.9415000);
                                                case 1: set_pos(playerid, -1969.2168294.005435.171983.879000);
                                                case 2: set_pos(playerid, 2200.77911394.184711.0625178.989600);
                                                case 3: set_pos(playerid, 2888.9858, -365.21578.138088.167700);
                                                case 4: set_pos(playerid, -1396.3988, -544.666214.1484216.095800);
                                        }

                                        if(ts_id < 3)
                                        {
                                                SendClientMessage(playerid, col_white, !""scm_info"Вы успешно приобрели транспортное средство для семьи.");
                                                SendClientMessage(playerid, col_white, !""scm_info"Оно было доставлено на семейный остров.");
                                        }
                                        else if(ts_id == 3)
                                        {
                                                SendClientMessage(playerid, col_white, !""scm_info"Вы успешно приобрели водное транспортное средство.");
                                                SendClientMessage(playerid, col_white, !""scm_info"Оно было доставлено к пирсу семейного острова.");
                                        }
                                        else if(ts_id == 4)
                                        {
                                                SendClientMessage(playerid, col_white, !""scm_info"Вы успешно приобрели воздушное транспортное средство.");
                                                SendClientMessage(playerid, col_white, !""scm_info"Оно было доставлено на вертолётную площадку семейного острова.");
                                        }
                                        return 1;
                                }
                        }
                }

 

 

Share this post


Link to post

0 answers to this question

There have been no answers to this question yet

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • D2DChat
      By D2DChat
      Список доработок/изменений:
      1.Добавлена команда /dostup
      2.Добавлена команда /adostup
      3. Добавлена команда /odostup
      4. Добавлена команда /imunka
      5. Добавлена команда /sledshow
      6. Изменён /mm
      7. Изменена /apanel
      8. Добавлена система ютуб
      9. Добавлена команда /sledpanel
    • D2DChat
      By D2DChat


      Скачать файл Delint RP (WAY OF LIFE)
      Список доработок/изменений:
      1.Добавлена команда /dostup
      2.Добавлена команда /adostup
      3. Добавлена команда /odostup
      4. Добавлена команда /imunka
      5. Добавлена команда /sledshow
      6. Изменён /mm
      7. Изменена /apanel
      8. Добавлена система ютуб
      9. Добавлена команда /sledpanel
      Добавил D2DChat Добавлено 21.02.2022 Категория Моды Автор D2DChat  
    • kekkomomek1941
      By kekkomomek1941
      Всем привет, нужно в моде сделать, чтобы при загрузке сервера брало айпи и порт с server.cfg и подключалось к базе данных, после чего в ней искало bind:port с server.cfg , и если этого айпи там не окажется, то сервер выключится, а если айпи найдется, то ничего не произойдет