Array index out of bounds
#1

I get like alot of errors and i dont know why, i think the problem is somewhere in onplayerupdate..


Код:
[00:05:46] [debug] Run time error 4: "Array index out of bounds"
[00:05:46] [debug]  Accessing element at index 400 past array upper bound 211
[00:05:46] [debug] AMX backtrace:
[00:05:46] [debug] #0 000e3374 in public cmd_kupivozilo (0x00000000, 0x0022868c) from rpfa.amx
[00:05:46] [debug] #1 native CallLocalFunction () [00472ad0] from samp-server.exe
[00:05:46] [debug] #2 00006368 in public OnPlayerCommandText (0x00000000, 0x0022865c) from rpfa.amx
[00:05:50] [debug] Run time error 4: "Array index out of bounds"
[00:05:50] [debug]  Accessing element at index 409 past array upper bound 211
[00:05:50] [debug] AMX backtrace:
[00:05:50] [debug] #0 00080690 in public RL_OnPlayerUpdate (0x00000000) from rpfa.amx
[00:05:50] [debug] #1 native CallLocalFunction () [00472ad0] from samp-server.exe
[00:05:50] [debug] #2 00009740 in public OnPlayerUpdate (0x00000000) from rpfa.amx
[00:05:51] [debug] Run time error 4: "Array index out of bounds"
[00:05:51] [debug]  Accessing element at index 411 past array upper bound 211
[00:05:51] [debug] AMX backtrace:
[00:05:51] [debug] #0 00080690 in public RL_OnPlayerUpdate (0x00000000) from rpfa.amx
[00:05:51] [debug] #1 native CallLocalFunction () [00472ad0] from samp-server.exe
[00:05:51] [debug] #2 00009740 in public OnPlayerUpdate (0x00000000) from rpfa.amx
[00:05:53] [debug] Run time error 4: "Array index out of bounds"
[00:05:53] [debug]  Accessing element at index 412 past array upper bound 211
[00:05:53] [debug] AMX backtrace:
[00:05:53] [debug] #0 00080690 in public RL_OnPlayerUpdate (0x00000000) from rpfa.amx
[00:05:53] [debug] #1 native CallLocalFunction () [00472ad0] from samp-server.exe
[00:05:53] [debug] #2 00009740 in public OnPlayerUpdate (0x00000000) from rpfa.amx
[00:05:55] [debug] Run time error 4: "Array index out of bounds"
[00:05:55] [debug]  Accessing element at index 413 past array upper bound 211
[00:05:55] [debug] AMX backtrace:
[00:05:55] [debug] #0 00080690 in public RL_OnPlayerUpdate (0x00000000) from rpfa.amx
[00:05:55] [debug] #1 native CallLocalFunction () [00472ad0] from samp-server.exe
[00:05:55] [debug] #2 00009740 in public OnPlayerUpdate (0x00000000) from rpfa.amx

This is what the problem is(i guess):

pawn Код:
if(LiderKupuje[playerid] == true)
    {
        new Keys, ud, lr, str[128], str2[128], ime[25];
        GetPlayerKeys(playerid, Keys, ud, lr); GetPlayerName(playerid, ime, sizeof(ime));

        if(lr > 0)
        {
            Autosalon[playerid]++;
            if(Autosalon[playerid] >= sizeof(OrgVozila)) Autosalon[playerid] = 0;
            DestroyVehicle(IzlozbenoVozilo[playerid]);
            IzlozbenoVozilo[playerid] = CreateVehicle(OrgVozila[Autosalon[playerid]][0], 2148.2092,-1166.2465,23.7537,271.1449, 1, 1, -1);
            format(str, sizeof(str), "Vozilo: %s", ImenaVozila[OrgVozila[Autosalon[playerid]][0]]);
            TextDrawSetString(LiderBuyingVeh0[playerid], str);
            format(str2, sizeof(str2), "Cena: %d", ImenaVozila[OrgVozila[Autosalon[playerid]][1]]);
            TextDrawSetString(LiderBuyingVeh1[playerid], str2);
        }
        else if(lr < 0)
        {
            Autosalon[playerid]--;
            if(Autosalon[playerid] < 0) Autosalon[playerid] = sizeof(OrgVozila)-1;
            DestroyVehicle(IzlozbenoVozilo[playerid]);
            IzlozbenoVozilo[playerid] = CreateVehicle(OrgVozila[Autosalon[playerid]][0], 2148.2092,-1166.2465,23.7537,271.1449, 1, 1, -1);
            format(str, sizeof(str), "Vozilo: %s", ImenaVozila[OrgVozila[Autosalon[playerid]][0]]);
            TextDrawSetString(LiderBuyingVeh0[playerid], str);
            format(str2, sizeof(str2), "Cena: %d", ImenaVozila[OrgVozila[Autosalon[playerid]][1]]);
            TextDrawSetString(LiderBuyingVeh1[playerid], str2);
        }
        if (Keys &  KEY_HANDBRAKE || Keys &  KEY_JUMP )
        {
            DestroyVehicle(IzlozbenoVozilo[playerid]);
            SCM(playerid, WHITE, "Odustali ste od kupovine vozila...");
            TogglePlayerControllable(playerid, 1);
            LiderKupuje[playerid] = false;
            SetCameraBehindPlayer(playerid);
            TextDrawHideForPlayer(playerid, LiderBuyingVeh0[playerid]);
            TextDrawHideForPlayer(playerid, LiderBuyingVeh1[playerid]);
        }
    }
Reply
#2

Dobar NL mod
Reply
#3

It's not NL, it's from scratch.
Reply
#4

Cant find any soulution yet, does anyone know, I'm sure this is the problem

pawn Код:
if(LiderKupuje[playerid] == true)
    {
        new Keys, ud, lr, str[128], str2[128], ime[25];
        GetPlayerKeys(playerid, Keys, ud, lr); GetPlayerName(playerid, ime, sizeof(ime));

        if(lr > 0)
        {
            Autosalon[playerid]++;
            if(Autosalon[playerid] >= sizeof(OrgVozila)) Autosalon[playerid] = 0;
            DestroyVehicle(IzlozbenoVozilo[playerid]);
            IzlozbenoVozilo[playerid] = CreateVehicle(OrgVozila[Autosalon[playerid]][0], 2148.2092,-1166.2465,23.7537,271.1449, 1, 1, -1);
            format(str, sizeof(str), "Vozilo: %s", ImenaVozila[OrgVozila[Autosalon[playerid]][0]]);
            TextDrawSetString(LiderBuyingVeh0[playerid], str);
            format(str2, sizeof(str2), "Cena: %d", ImenaVozila[OrgVozila[Autosalon[playerid]][1]]);
            TextDrawSetString(LiderBuyingVeh1[playerid], str2);
        }
        else if(lr < 0)
        {
            Autosalon[playerid]--;
            if(Autosalon[playerid] < 0) Autosalon[playerid] = sizeof(OrgVozila)-1;
            DestroyVehicle(IzlozbenoVozilo[playerid]);
            IzlozbenoVozilo[playerid] = CreateVehicle(OrgVozila[Autosalon[playerid]][0], 2148.2092,-1166.2465,23.7537,271.1449, 1, 1, -1);
            format(str, sizeof(str), "Vozilo: %s", ImenaVozila[OrgVozila[Autosalon[playerid]][0]]);
            TextDrawSetString(LiderBuyingVeh0[playerid], str);
            format(str2, sizeof(str2), "Cena: %d", ImenaVozila[OrgVozila[Autosalon[playerid]][1]]);
            TextDrawSetString(LiderBuyingVeh1[playerid], str2);
        }
        if (Keys &  KEY_HANDBRAKE || Keys &  KEY_JUMP )
        {
            DestroyVehicle(IzlozbenoVozilo[playerid]);
            SCM(playerid, WHITE, "Odustali ste od kupovine vozila...");
            TogglePlayerControllable(playerid, 1);
            LiderKupuje[playerid] = false;
            SetCameraBehindPlayer(playerid);
            TextDrawHideForPlayer(playerid, LiderBuyingVeh0[playerid]);
            TextDrawHideForPlayer(playerid, LiderBuyingVeh1[playerid]);
        }
    }
Reply
#5

Anyone ?
Reply
#6

What is 211 on your server? players or vehicles or what?
Reply
#7

Maybe this ?

pawn Код:
IzlozbenoVozilo[playerid] = CreateVehicle(OrgVozila[Autosalon[playerid]][0], 2148.2092,-1166.2465,23.7537,271.1449, 1, 1, -1);
        format(str, sizeof(str), "Vozilo: %s", ImenaVozila[OrgVozila[Autosalon[playerid]][0]]);
        PlayerTextDrawSetString(playerid, LiderAutoBuy0[playerid], str);
        format(str2, sizeof(str2), "Cena: %d", ImenaVozila[OrgVozila[Autosalon[playerid]][1]]);
        PlayerTextDrawSetString(playerid, LiderAutoBuy1[playerid], str2);
pawn Код:
new OrgVozila[21][2] =
{
    {400, 50000},
    {409, 54000},
    {411, 60000},
    {412, 30000},
    {413, 24000},
    {421, 19000},
    {426, 20000},
    {445, 20000},
    {451, 112000},
    {461, 12000},
    {463, 11000},
    {466, 17000},
    {471, 16000},
    {480, 90000},
    {482, 26000},
    {489, 45000},
    {507, 20000},
    {521, 17000},
    {536, 17000},
    {567, 17000},
    {560, 60000}
};
Reply
#8

anyone >?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)