• Уважаемый Гость.
    - Прежде чем создать свою тему, пожалуйста, попробуй воспользоваться этим -> ПОИСКОМ !!!
    - После решения Вашего вопроса (проблемы) - нажмите "Лучший ответ", на сообщении, которое его решило. За игнорирование этого действия - Вы получите соответствующее предупреждение. Мы - стараемся Вам помочь. Уделите 10 секунд - чтобы нажать кнопку. (Если у Вас нет такой возможности - укажите в последнем своем сообщении какой ответ Вы считаете лучшим. Наши модераторы сделают это за Вас)
    ЗАПРЕЩЕНО:
    - Cоздавать темы с названиями "Помогите", "Плиз", "Ошибка", "Не могу найти", "Хелп" и тому подобное;
    - Cоздавать темы без детального описания того, что нужно исправить.
    - Cоздавать темы из одного скриншота.
    За игнор правил форума - Ваша тема будет удалена, а Вы получите системное предупреждение.

Неправильная загрузка транспорта из бд

akvarizum

Новичок
Приветствую, вопрос состоит в том что в бд к примеру хранится 10 транспорта, если они загружаются по порядку 1,2,3,4,5,6... то данные транспорта присваиваются правильно к нужному транспорту, но если например из 10 авто удалить например 5 транспорт, то после 5 транспорта сбивается загрузка и перестаёт работать система зажигания для этого транспорта, вот код загрузки данных авто
Код:
publics LoadCars()
{
      new rows[2]; new temp[10], carid[5];
    cache_get_data(rows[0], rows[1]);
    if(rows[0] < 1) return 1;
    new full;

    for(new i = 0; i < rows[0]; i++)
    {
        full++; fullCars++; //printf("Загруженоf [%d] машин.", full);
        cache_get_field_content(i,"ID",carid),Veh[i+1][ID] = strval(carid);
         cache_get_field_content(i,"Model",temp),Veh[i+1][Model] = strval(temp);
        cache_get_field_content(i,"Owner",temp),Veh[i+1][Owner] = strval(temp);
        cache_get_field_content(i,"Member",temp),Veh[i+1][Member] = strval(temp);
        cache_get_field_content(i,"SBMoneys",temp),Veh[i+1][SBMoneys] = strval(temp);
        cache_get_field_content(i,"RentPlayer",temp),Veh[i+1][RentPlayer] = strval(temp);
        cache_get_field_content(i,"Fraction",temp),Veh[i+1][Fraction] = strval(temp);
        cache_get_field_content(i,"Engin",temp),Veh[i+1][Engin] = strval(temp);
        cache_get_field_content(i,"EngineOn",temp),Veh[i+1][EngineOn] = strval(temp);
        cache_get_field_content(i,"Lock",temp),Veh[i+1][Lock] = strval(temp);
        cache_get_field_content(i,"Fuel",temp),Veh[i+1][Fuel] = strval(temp);
        cache_get_field_content(i,"Health",temp),Veh[i+1][Health] = floatstr(temp);
        cache_get_field_content(i,"x",temp),Veh[i+1][x] = floatstr(temp);
        cache_get_field_content(i,"y",temp),Veh[i+1][y] = floatstr(temp);
        cache_get_field_content(i,"z",temp),Veh[i+1][z] = floatstr(temp);
        cache_get_field_content(i,"r",temp),Veh[i+1][r] = floatstr(temp);
        cache_get_field_content(i,"identifier",temp),Veh[i+1][identifier] = strval(temp);
        cache_get_field_content(i,"fine",temp),Veh[i+1][fine] = strval(temp);
        cache_get_field_content(i,"Spoiler",temp),Veh[i+1][Spoiler] = strval(temp);
        cache_get_field_content(i,"Color1",temp),Veh[i+1][Color1] = strval(temp);
        cache_get_field_content(i,"Color2",temp),Veh[i+1][Color2] = strval(temp);
        cache_get_field_content(i,"Wheels",temp),Veh[i+1][Wheels] = strval(temp);
        cache_get_field_content(i,"Nitro",temp),Veh[i+1][Nitro] = strval(temp);
        cache_get_field_content(i,"FrontBumper",temp),Veh[i+1][FrontBumper] = strval(temp);
        cache_get_field_content(i,"RearBumper",temp),Veh[i+1][RearBumper] = strval(temp);
        cache_get_field_content(i,"Hood",temp),Veh[i+1][Hood] = strval(temp);
        cache_get_field_content(i,"Lamps",temp),Veh[i+1][Lamps] = strval(temp);
        cache_get_field_content(i,"Exhaust",temp),Veh[i+1][Exhaust] = strval(temp);
        cache_get_field_content(i,"Roof",temp),Veh[i+1][Roof] = strval(temp);
        cache_get_field_content(i,"Hydraulics",temp),Veh[i+1][Hydraulics] = strval(temp);
        cache_get_field_content(i,"BulbarFront",temp),Veh[i+1][BulbarFront] = strval(temp);
        cache_get_field_content(i,"BulbarRear",temp),Veh[i+1][BulbarRear] = strval(temp);
        cache_get_field_content(i,"Vents",temp),Veh[i+1][Vents] = strval(temp);
        cache_get_field_content(i,"InvCarSlot0",temp),Veh[i+1][InvCarSlot][0] = strval(temp);
        cache_get_field_content(i,"InvCarSlot1",temp),Veh[i+1][InvCarSlot][1] = strval(temp);
        cache_get_field_content(i,"InvCarSlot2",temp),Veh[i+1][InvCarSlot][2] = strval(temp);
        cache_get_field_content(i,"InvCarSlot2",temp),Veh[i+1][InvCarSlot][3] = strval(temp);
        cache_get_field_content(i,"InvCarSlot4",temp),Veh[i+1][InvCarSlot][4] = strval(temp);
        cache_get_field_content(i,"InvCarSlot5",temp),Veh[i+1][InvCarSlot][5] = strval(temp);
        cache_get_field_content(i,"InvCarSlot6",temp),Veh[i+1][InvCarSlot][6] = strval(temp);
        cache_get_field_content(i,"InvCarSlot7",temp),Veh[i+1][InvCarSlot][7] = strval(temp);
        cache_get_field_content(i,"InvCarSlot8",temp),Veh[i+1][InvCarSlot][8] = strval(temp);
        cache_get_field_content(i,"InvCarSlot9",temp),Veh[i+1][InvCarSlot][9] = strval(temp);
        cache_get_field_content(i,"InvCarSlot10",temp),Veh[i+1][InvCarSlot][10] = strval(temp);
        cache_get_field_content(i,"InvCarSlot11",temp),Veh[i+1][InvCarSlot][11] = strval(temp);
        cache_get_field_content(i,"InvCarSlot12",temp),Veh[i+1][InvCarSlot][12] = strval(temp);
        cache_get_field_content(i,"InvCarSlot13",temp),Veh[i+1][InvCarSlot][13] = strval(temp);
        cache_get_field_content(i,"InvCarSlot14",temp),Veh[i+1][InvCarSlot][14] = strval(temp);
        cache_get_field_content(i,"InvCarSlot15",temp),Veh[i+1][InvCarSlot][15] = strval(temp);
        cache_get_field_content(i,"InvCarSlot16",temp),Veh[i+1][InvCarSlot][16] = strval(temp);
        cache_get_field_content(i,"InvCarSlot17",temp),Veh[i+1][InvCarSlot][17] = strval(temp);
        cache_get_field_content(i,"InvCarSlot18",temp),Veh[i+1][InvCarSlot][18] = strval(temp);
        cache_get_field_content(i,"InvCarSlot19",temp),Veh[i+1][InvCarSlot][19] = strval(temp);
        cache_get_field_content(i,"InvCarSlot20",temp),Veh[i+1][InvCarSlot][20] = strval(temp);
        cache_get_field_content(i,"InvCarSlot21",temp),Veh[i+1][InvCarSlot][21] = strval(temp);
        cache_get_field_content(i,"InvCarSlot22",temp),Veh[i+1][InvCarSlot][22] = strval(temp);
        cache_get_field_content(i,"InvCarSlot23",temp),Veh[i+1][InvCarSlot][23] = strval(temp);
        cache_get_field_content(i,"InvCarSlot24",temp),Veh[i+1][InvCarSlot][24] = strval(temp);
        cache_get_field_content(i,"InvCarSlot25",temp),Veh[i+1][InvCarSlot][25] = strval(temp);
        cache_get_field_content(i,"InvCarSlot26",temp),Veh[i+1][InvCarSlot][26] = strval(temp);
        cache_get_field_content(i,"InvCarSlot27",temp),Veh[i+1][InvCarSlot][27] = strval(temp);
        cache_get_field_content(i,"InvCarSlot28",temp),Veh[i+1][InvCarSlot][28] = strval(temp);

        cache_get_field_content(i,"InvCarCount0",temp),Veh[i+1][InvCarCount][0] = strval(temp);
        cache_get_field_content(i,"InvCarCount1",temp),Veh[i+1][InvCarCount][1] = strval(temp);
        cache_get_field_content(i,"InvCarCount2",temp),Veh[i+1][InvCarCount][2] = strval(temp);
        cache_get_field_content(i,"InvCarCount3",temp),Veh[i+1][InvCarCount][3] = strval(temp);
        cache_get_field_content(i,"InvCarCount4",temp),Veh[i+1][InvCarCount][4] = strval(temp);
        cache_get_field_content(i,"InvCarCount5",temp),Veh[i+1][InvCarCount][5] = strval(temp);
        cache_get_field_content(i,"InvCarCount6",temp),Veh[i+1][InvCarCount][6] = strval(temp);
        cache_get_field_content(i,"InvCarCount7",temp),Veh[i+1][InvCarCount][7] = strval(temp);
        cache_get_field_content(i,"InvCarCount8",temp),Veh[i+1][InvCarCount][8] = strval(temp);
        cache_get_field_content(i,"InvCarCount9",temp),Veh[i+1][InvCarCount][9] = strval(temp);
        cache_get_field_content(i,"InvCarCount10",temp),Veh[i+1][InvCarCount][10] = strval(temp);
        cache_get_field_content(i,"InvCarCount11",temp),Veh[i+1][InvCarCount][11] = strval(temp);
        cache_get_field_content(i,"InvCarCount12",temp),Veh[i+1][InvCarCount][12] = strval(temp);
        cache_get_field_content(i,"InvCarCount13",temp),Veh[i+1][InvCarCount][13] = strval(temp);
        cache_get_field_content(i,"InvCarCount14",temp),Veh[i+1][InvCarCount][14] = strval(temp);
        cache_get_field_content(i,"InvCarCount15",temp),Veh[i+1][InvCarCount][15] = strval(temp);
        cache_get_field_content(i,"InvCarCount16",temp),Veh[i+1][InvCarCount][16] = strval(temp);
        cache_get_field_content(i,"InvCarCount17",temp),Veh[i+1][InvCarCount][17] = strval(temp);
        cache_get_field_content(i,"InvCarCount18",temp),Veh[i+1][InvCarCount][18] = strval(temp);
        cache_get_field_content(i,"InvCarCount19",temp),Veh[i+1][InvCarCount][19] = strval(temp);
        cache_get_field_content(i,"InvCarCount20",temp),Veh[i+1][InvCarCount][20] = strval(temp);
        cache_get_field_content(i,"InvCarCount21",temp),Veh[i+1][InvCarCount][21] = strval(temp);
        cache_get_field_content(i,"InvCarCount22",temp),Veh[i+1][InvCarCount][22] = strval(temp);
        cache_get_field_content(i,"InvCarCount23",temp),Veh[i+1][InvCarCount][23] = strval(temp);
        cache_get_field_content(i,"InvCarCount24",temp),Veh[i+1][InvCarCount][24] = strval(temp);
        cache_get_field_content(i,"InvCarCount25",temp),Veh[i+1][InvCarCount][25] = strval(temp);
        cache_get_field_content(i,"InvCarCount26",temp),Veh[i+1][InvCarCount][26] = strval(temp);
        cache_get_field_content(i,"InvCarCount27",temp),Veh[i+1][InvCarCount][27] = strval(temp);
        cache_get_field_content(i,"InvCarCount28",temp),Veh[i+1][InvCarCount][28] = strval(temp);
        SetVehicleHealth(i+1, Veh[i+1][Health]);
        Veh[i+1][Createveh] = CreateVehicle(Veh[i+1][Model], Veh[i+1][x], Veh[i+1][y], Veh[i+1][z], Veh[i+1][r], Veh[i+1][Color1], Veh[i+1][Color2], 9999);
        SetVehicleParamsEx(i+1, Veh[i+1][Engin], Veh[i+1][Light], Veh[i+1][Alarms], Veh[i+1][Lock], Veh[i+1][Bonnets], Veh[i+1][Boots], Veh[i+1][Objective]);
        SetVehicleVirtualWorld(Veh[i+1][Createveh], 0);
        //===========================
        if(Veh[i+1][RentPlayer] == 0)
         {
            VehText[i+1] = Create3DTextLabel("Арендный транспорт", COLOR_BLUE, 7.77, 7.77, 7.77, 20.0, 0, 1);
            Attach3DTextLabelToVehicle(VehText[i+1], Veh[i+1][Createveh], 0.0, 0.0, 2.0);
        }
         if(Veh[i+1][Owner] == 0)
         {
            printf("Model3D: %d", Veh[i+1][Model]);
             static str[] = "{F3FF02}Продаётся";
            format(str, sizeof(str), str, Veh[i+1][SBMoneys]);
            VehText[i+1] = Create3DTextLabel(str, COLOR_BLUE, 7.77, 7.77, 7.77, 20.0, 0, 1);
            Attach3DTextLabelToVehicle(VehText[i+1], Veh[i+1][Createveh], 0.0, 0.0, 2.0);
        }
        if(Veh[i+1][fine] != 0)
        {
            SetVehicleParamsEx(i+1, Veh[i+1][Engin], Veh[i+1][Light], Veh[i+1][Alarms], Veh[i+1][Lock], Veh[i+1][Bonnets], Veh[i+1][Boots], Veh[i+1][Objective]);
            SetVehicleVirtualWorld(Veh[i+1][Createveh], 1);
        }
        if(Veh[i+1][Spoiler] != 0) AddVehicleComponent(i+1, Veh[i+1][Spoiler]);
        ChangeVehicleColor(i+1, Veh[i+1][Color1], Veh[i+1][Color2]);
        if(Veh[i+1][Wheels] != 0) AddVehicleComponent(i+1, Veh[i+1][Wheels]);
        if(Veh[i+1][Nitro] != 0) AddVehicleComponent(i+1, Veh[i+1][Nitro]);
        if(Veh[i+1][FrontBumper] != 0) AddVehicleComponent(i+1, Veh[i+1][FrontBumper]);
        if(Veh[i+1][RearBumper] != 0) AddVehicleComponent(i+1, Veh[i+1][RearBumper]);
        if(Veh[i+1][Hood] != 0) AddVehicleComponent(i+1, Veh[i+1][Hood]);
        if(Veh[i+1][Lamps] != 0) AddVehicleComponent(i+1, Veh[i+1][Lamps]);
        if(Veh[i+1][Exhaust] != 0) AddVehicleComponent(i+1, Veh[i+1][Exhaust]);
        if(Veh[i+1][Roof] != 0) AddVehicleComponent(i+1, Veh[i+1][Roof]);
        if(Veh[i+1][Hydraulics] != 0) AddVehicleComponent(i+1, Veh[i+1][Hydraulics]);
        if(Veh[i+1][BulbarFront] != 0) AddVehicleComponent(i+1, Veh[i+1][BulbarFront]);
        if(Veh[i+1][BulbarRear] != 0) AddVehicleComponent(i+1, Veh[i+1][BulbarRear]);
        if(Veh[i+1][Vents] != 0) AddVehicleComponent(i+1, Veh[i+1][Vents]);

    }
    printf("Загружено [%d] транспорта.", full);
    return 1;
}
Veh[Createveh] в будущем не совподает с GetPlayerVehicleID(playerid);
 
Сверху Снизу