SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Scripting Help (https://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   [debug] Run time error 4: "Array index out of bounds" (https://forum.sa-mp.com/showthread.php?t=671104)

Jumberi 09/12/2019 08:56 PM

[debug] Run time error 4: "Array index out of bounds"
 
Code:

[2019/12/09 02:26:57] [debug] Run time error 4: "Array index out of bounds"
[2019/12/09 02:26:57] [debug]  Attempted to read/write array element at index 50 in array of size 50
[2019/12/09 02:26:57] [debug] AMX backtrace:
[2019/12/09 02:26:57] [debug] #0 007d8830 in public EntersExitsLoad () in gamemode.amx

HI GUYS.. I have problem with this so can any of u help me?

Code:

forward EntersExitsLoad();
public EntersExitsLoad()
{
        Iter_Clear(EnterExit);
        new rows = cache_num_rows();
        new string[256];
        for(new i = 0; i < rows; i++)
        {
                printf("i: %d", i);

                cache_get_value_name_int(i, "id", EntersExits[i][eeId]);
                cache_get_value_name_int(i, "EnterInt", EntersExits[i][eeEnterInt]);
                cache_get_value_name_int(i, "ExitInt", EntersExits[i][eeExitInt]);
                cache_get_value_name_int(i, "EnterVW", EntersExits[i][eeEnterVW]);
                cache_get_value_name_int(i, "ExitVW", EntersExits[i][eeExitVW]);
                cache_get_value_name(i, "Name", EntersExits[i][eeName], 32);
                cache_get_value_name_float(i, "EnterX", EntersExits[i][eeEnterX]);
                cache_get_value_name_float(i, "EnterY", EntersExits[i][eeEnterY]);
                cache_get_value_name_float(i, "EnterZ", EntersExits[i][eeEnterZ]);
                cache_get_value_name_float(i, "ExitX", EntersExits[i][eeExitX]);
                cache_get_value_name_float(i, "ExitY", EntersExits[i][eeExitY]);
                cache_get_value_name_float(i, "ExitZ", EntersExits[i][eeExitZ]);
                format(string, sizeof string, "\"%s\"\n{DBDBDB}Rašykite /enter", EntersExits[i][eeName]);
                EntersExits[i][eeEnterLabel] = CreateDynamic3DTextLabel(string, 0xFFAB00FF, EntersExits[i][eeEnterX], EntersExits[i][eeEnterY], EntersExits[i][eeEnterZ], 13.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, EntersExits[i][eeEnterVW], EntersExits[i][eeEnterInt]);
                EntersExits[i][eeExitLabel] = CreateDynamic3DTextLabel("Išėjimas\nRašykite /exit", 0x618B4CFF, EntersExits[i][eeExitX], EntersExits[i][eeExitY], EntersExits[i][eeExitZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, EntersExits[i][eeExitVW], EntersExits[i][eeExitInt]);
                Iter_Add(EnterExit, i);
        }
        printf("[load] %d iejimu/isejimu", rows);
        return 1;
}


Jumberi 09/12/2019 09:07 PM

Re: [debug] Run time error 4: "Array index out of bounds"
 
fixed nvm


All times are GMT. The time now is 01:10 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.