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

Attempted to read/write array element at negative index -9

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

Рустик

Изучающий
Пользователь
Регистрация
30 Мар 2016
Сообщения
197
Лучшие ответы
3
Репутация
15
Помогите при вводе команды. ошибка
[debug] Run time error 4: "Array index out of bounds"
[debug] Attempted to read/write array element at negative index -9
[debug] AMX backtrace:
[debug] #0 008540b0 in main (playerid=0, ... <1 argument>)
Ошибка тут: new gRollPrizes[MAX_PLAYERS][9];
PHP:
CMD:roll(playerid)
{
    if(0 == gRollStatus{playerid})
    {
        gRollStatus{playerid} = 1;

        SendClientMessage(playerid, 0xAFAFAFFF, "Вы открыли игровую рулетку! Чтобы крутить данную рулетку, нажмите \"ROLL\"");
        SendClientMessage(playerid, 0xAFAFAFFF, "Для закрытия рулетки, введите команду снова.");

        t_pRoll[playerid][0] = CreatePlayerTextDraw(playerid, 269.5000, 175.3333, ""); // пусто
        PlayerTextDrawTextSize(playerid, t_pRoll[playerid][0], 27.0000, 34.0000);
        PlayerTextDrawAlignment(playerid, t_pRoll[playerid][0], 1);
        PlayerTextDrawColor(playerid, t_pRoll[playerid][0], -1);
        PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][0], 303174144);
        PlayerTextDrawFont(playerid, t_pRoll[playerid][0], 5);
        PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][0], 0);
        PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][0], 0);
        PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][0], 1550);
        PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][0], 0.0000, 0.0000, 0.0000, 1.0000);

        t_pRoll[playerid][1] = CreatePlayerTextDraw(playerid, 342.0000, 259.9555, ""); // пусто
        PlayerTextDrawTextSize(playerid, t_pRoll[playerid][1], 27.0000, 34.0000);
        PlayerTextDrawAlignment(playerid, t_pRoll[playerid][1], 1);
        PlayerTextDrawColor(playerid, t_pRoll[playerid][1], -1);
        PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][1], 303174144);
        PlayerTextDrawFont(playerid, t_pRoll[playerid][1], 5);
        PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][1], 0);
        PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][1], 0);
        PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][1], 1550);
        PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][1], 0.0000, 0.0000, 0.0000, 1.0000);

        t_pRoll[playerid][2] = CreatePlayerTextDraw(playerid, 268.5000, 259.9555, ""); // пусто
        PlayerTextDrawTextSize(playerid, t_pRoll[playerid][2], 27.0000, 34.0000);
        PlayerTextDrawAlignment(playerid, t_pRoll[playerid][2], 1);
        PlayerTextDrawColor(playerid, t_pRoll[playerid][2], -1);
        PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][2], 303174144);
        PlayerTextDrawFont(playerid, t_pRoll[playerid][2], 5);
        PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][2], 0);
        PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][2], 0);
        PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][2], 1550);
        PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][2], 0.0000, 0.0000, 0.0000, 1.0000);

        t_pRoll[playerid][3] = CreatePlayerTextDraw(playerid, 340.0000, 176.5777, ""); // пусто
        PlayerTextDrawTextSize(playerid, t_pRoll[playerid][3], 29.0000, 32.0000);
        PlayerTextDrawAlignment(playerid, t_pRoll[playerid][3], 1);
        PlayerTextDrawColor(playerid, t_pRoll[playerid][3], -1);
        PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][3], 303174144);
        PlayerTextDrawFont(playerid, t_pRoll[playerid][3], 5);
        PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][3], 0);
        PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][3], 0);
        PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][3], 1277);
        PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][3], 0.0000, 0.0000, 0.0000, 1.0000);

        t_pRoll[playerid][4] = CreatePlayerTextDraw(playerid, 342.5000, 208.9333, ""); // пусто
        PlayerTextDrawTextSize(playerid, t_pRoll[playerid][4], 47.0000, 51.0000);
        PlayerTextDrawAlignment(playerid, t_pRoll[playerid][4], 1);
        PlayerTextDrawColor(playerid, t_pRoll[playerid][4], -1);
        PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][4], 303174144);
        PlayerTextDrawFont(playerid, t_pRoll[playerid][4], 5);
        PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][4], 0);
        PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][4], 0);
        PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][4], 411);
        PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][4], 0.0000, 0.0000, 20.0000, 1.0000);
        PlayerTextDrawSetPreviewVehCol(playerid, t_pRoll[playerid][4], 1, 1);

        t_pRoll[playerid][5] = CreatePlayerTextDraw(playerid, 300.5000, 278.0000, ""); // пусто
        PlayerTextDrawTextSize(playerid, t_pRoll[playerid][5], 37.0000, 40.0000);
        PlayerTextDrawAlignment(playerid, t_pRoll[playerid][5], 1);
        PlayerTextDrawColor(playerid, t_pRoll[playerid][5], -1);
        PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][5], 303174144);
        PlayerTextDrawFont(playerid, t_pRoll[playerid][5], 5);
        PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][5], 0);
        PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][5], 0);
        PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][5], 46);
        PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][5], 0.0000, 0.0000, 20.0000, 1.0000);

        t_pRoll[playerid][6] = CreatePlayerTextDraw(playerid, 300.0000, 153.5555, ""); // пусто
        PlayerTextDrawTextSize(playerid, t_pRoll[playerid][6], 37.0000, 40.0000);
        PlayerTextDrawAlignment(playerid, t_pRoll[playerid][6], 1);
        PlayerTextDrawColor(playerid, t_pRoll[playerid][6], -1);
        PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][6], 303174144);
        PlayerTextDrawFont(playerid, t_pRoll[playerid][6], 5);
        PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][6], 0);
        PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][6], 0);
        PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][6], 46);
        PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][6], 0.0000, 0.0000, 20.0000, 1.0000);

        t_pRoll[playerid][7] = CreatePlayerTextDraw(playerid, 244.0000, 209.5555, ""); // пусто
        PlayerTextDrawTextSize(playerid, t_pRoll[playerid][7], 47.0000, 51.0000);
        PlayerTextDrawAlignment(playerid, t_pRoll[playerid][7], 1);
        PlayerTextDrawColor(playerid, t_pRoll[playerid][7], -1);
        PlayerTextDrawBackgroundColor(playerid, t_pRoll[playerid][7], 303174144);
        PlayerTextDrawFont(playerid, t_pRoll[playerid][7], 5);
        PlayerTextDrawSetProportional(playerid, t_pRoll[playerid][7], 0);
        PlayerTextDrawSetShadow(playerid, t_pRoll[playerid][7], 0);
        PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][7], 460);
        PlayerTextDrawSetPreviewRot(playerid, t_pRoll[playerid][7], 0.0000, 0.0000, 20.0000, 1.0000);
        PlayerTextDrawSetPreviewVehCol(playerid, t_pRoll[playerid][7], 1, 1);

        for(new i; i < 8; i++)
        {
            gRollPrizes[playerid][i-9] = roll_gift[random(sizeof roll_gift)];
            PlayerTextDrawSetPreviewModel(playerid, t_pRoll[playerid][i], gRollPrizes[playerid][i-9]);
        }
        for(new i; i < sizeof gRoll; i++) TextDrawShowForPlayer(playerid, gRoll[i]);

        for(new i; i < 8; i++) PlayerTextDrawShow(playerid, t_pRoll[playerid][i]);

        SelectTextDraw(playerid, 0xFFFFFFFF);
    }
    else if(1 == gRollStatus{playerid})
    {
        for(new i; i < sizeof gRoll; i++) TextDrawHideForPlayer(playerid, gRoll[i]);
         for(new i; i < 8; i++) PlayerTextDrawDestroy(playerid, t_pRoll[playerid][i]);
        CancelSelectTextDraw(playerid);
    }
}
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу