SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 11/11/2019, 04:15 AM   #1
Th3N0oB
Big Clucker
 
Join Date: Oct 2016
Location: Ecuador
Posts: 132
Reputation: 1
Question [HELP] Run time error 4: "Array index out of bounds"

pawn Code:
[debug] Run time error 4: "Array index out of bounds"
 [debug]  Attempted to read/write array element at index 682 in array of size 682
[debug] AMX backtrace:
[debug] #0 000029ec in ?? (1141407744, 1136328704, 1116143616, 1075838976, 10457087, 1120403456) from SARP.amx
[debug] #1 00077e68 in public CargarTodo () from SARP.amx

Why is debug # 0? I find no explanation.

Debug Code # 1: CargarTodo ()

pawn Code:
forward CargarTodo();
public CargarTodo()
{
    CargarHouses();
    CargarFacciones();
    CargarUsers();

    CN = TextDrawCreate(1.390947, 2.083340, "Nuevo Textdraw");
    TextDrawLetterSize(CN, 0.000000, 11.546119);
    TextDrawTextSize(CN, 649.000000, 0.000000);
    TextDrawAlignment(CN, 1);
    TextDrawColor(CN, -1);
    TextDrawUseBox(CN, 1);
    TextDrawBoxColor(CN, 255);
    TextDrawSetShadow(CN, 0);
    TextDrawSetOutline(CN, 0);
    TextDrawBackgroundColor(CN, 255);
    TextDrawFont(CN, 1);
    TextDrawSetProportional(CN, 1);
    TextDrawSetShadow(CN, 0);

    CN2 = TextDrawCreate(331.097686, 21.996381, "Texto");
    TextDrawLetterSize(CN2, 1.086849, 4.907499);
    TextDrawAlignment(CN2, 2);
    TextDrawColor(CN2, -1);
    TextDrawSetShadow(CN2, 0);
    TextDrawSetOutline(CN2, 0);
    TextDrawBackgroundColor(CN2, 255);
    TextDrawFont(CN2, 0);
    TextDrawSetProportional(CN2, 1);
    TextDrawSetShadow(CN2, 0);
    TextDrawSetSelectable(CN2, 0);

    CN3 = TextDrawCreate(358.025604, 59.929340, "Texto");
    TextDrawLetterSize(CN3, 0.337215, 2.288329);
    TextDrawAlignment(CN3, 2);
    TextDrawColor(CN3, -1);
    TextDrawSetShadow(CN3, 0);
    TextDrawSetOutline(CN3, 0);
    TextDrawBackgroundColor(CN3, 255);
    TextDrawFont(CN3, 2);
    TextDrawSetProportional(CN3, 1);
    TextDrawSetShadow(CN3, 0);
    TextDrawSetSelectable(CN3, 0);

    CN4 = TextDrawCreate(638.411499, 97.846000, "Texto");
    TextDrawLetterSize(CN4, 0.133877, 0.975831);
    TextDrawAlignment(CN4, 3);
    TextDrawColor(CN4, -126);
    TextDrawSetShadow(CN4, 0);
    TextDrawSetOutline(CN4, 0);
    TextDrawBackgroundColor(CN4, 255);
    TextDrawFont(CN4, 2);
    TextDrawSetProportional(CN4, 1);
    TextDrawSetShadow(CN4, 0);
    TextDrawSetSelectable(CN4, true);

    CN5 = TextDrawCreate(560.515563, 433.614837, "Texto");
    TextDrawBackgroundColor(CN5, 255);
    TextDrawLetterSize(CN5, 0.199941, 1.325832);
    TextDrawColor(CN5, -1);
    TextDrawFont(CN5, 2);
    TextDrawSetProportional(CN5, 1);
    TextDrawSetOutline(CN5, 0);
    TextDrawAlignment(CN5, 2);
    TextDrawSetShadow(CN5, 1);
    TextDrawSetSelectable(CN5, 0);

    MapaGTA = TextDrawCreate(325.000000, 13.000000, "samaps:map");
    TextDrawBackgroundColor(MapaGTA, 255);
    TextDrawFont(MapaGTA, 4);
    TextDrawTextSize(MapaGTA, 310.000000, 324.000000);
    TextDrawColor(MapaGTA, 255);
    TextDrawSetOutline(MapaGTA, 0);
    TextDrawSetProportional(MapaGTA, 1);
    TextDrawSetShadow(MapaGTA, 1);
    TextDrawUseBox(MapaGTA, 1);
    TextDrawBoxColor(MapaGTA, 255);

    MapaGTA2 = TextDrawCreate(329.000000, 37.000000, "samaps:map");
    TextDrawBackgroundColor(MapaGTA2, 255);
    TextDrawFont(MapaGTA2, 4);
    TextDrawTextSize(MapaGTA2, 302.000000, 295.000000);
    TextDrawColor(MapaGTA2, -1);
    TextDrawSetOutline(MapaGTA2, 0);
    TextDrawSetProportional(MapaGTA2, 1);
    TextDrawSetShadow(MapaGTA2, 1);
    TextDrawUseBox(MapaGTA2, 1);
    TextDrawBoxColor(MapaGTA2, 124);

    MapaGTA3 = TextDrawCreate(333.000000, 16.000000, "GPS");
    TextDrawLetterSize(MapaGTA3, 0.579999, 1.800000);
    TextDrawAlignment(MapaGTA3, 1);
    TextDrawColor(MapaGTA3, -1);
    TextDrawSetShadow(MapaGTA3, 1);
    TextDrawSetOutline(MapaGTA3, 0);
    TextDrawBackgroundColor(MapaGTA3, 255);
    TextDrawFont(MapaGTA3, 2);
    TextDrawSetProportional(MapaGTA3, 1);

    MapaGTA4 = TextDrawCreate(457.000000, 23.000000, "Usa");
    TextDrawLetterSize(MapaGTA4, 0.259999, 0.699998);
    TextDrawAlignment(MapaGTA4, 1);
    TextDrawColor(MapaGTA4, -1);
    TextDrawSetShadow(MapaGTA4, 1);
    TextDrawSetOutline(MapaGTA4, 0);
    TextDrawBackgroundColor(MapaGTA4, 255);
    TextDrawFont(MapaGTA4, 2);
    TextDrawSetProportional(MapaGTA4, 1);

    MapaGTA5 = TextDrawCreate(479.000000, 23.000000, "/ocultar gps");
    TextDrawLetterSize(MapaGTA5, 0.260000, 0.699999);
    TextDrawAlignment(MapaGTA5, 1);
    TextDrawColor(MapaGTA5, -624405505);
    TextDrawSetShadow(MapaGTA5, 1);
    TextDrawSetOutline(MapaGTA5, 0);
    TextDrawBackgroundColor(MapaGTA5, 255);
    TextDrawFont(MapaGTA5, 2);
    TextDrawSetProportional(MapaGTA5, 1);

    MapaGTA6 = TextDrawCreate(558.000000, 23.000000, "para cerrar");
    TextDrawLetterSize(MapaGTA6, 0.260000, 0.699999);
    TextDrawAlignment(MapaGTA6, 1);
    TextDrawColor(MapaGTA6, -1);
    TextDrawSetShadow(MapaGTA6, 1);
    TextDrawSetOutline(MapaGTA6, 0);
    TextDrawBackgroundColor(MapaGTA6, 255);
    TextDrawFont(MapaGTA6, 2);
    TextDrawSetProportional(MapaGTA6, 1);

    MapaGTA7 = TextDrawCreate(333.000000, 16.000000, "PANTALLA");
    TextDrawLetterSize(MapaGTA7, 0.579999, 1.800000);
    TextDrawAlignment(MapaGTA7, 1);
    TextDrawColor(MapaGTA7, -1);
    TextDrawSetShadow(MapaGTA7, 1);
    TextDrawSetOutline(MapaGTA7, 0);
    TextDrawBackgroundColor(MapaGTA7, 255);
    TextDrawFont(MapaGTA7, 2);
    TextDrawSetProportional(MapaGTA7, 1);

    MapaGTA8 = TextDrawCreate(479.000000, 23.000000, "/ocultar pantalla");
    TextDrawLetterSize(MapaGTA8, 0.260000, 0.699999);
    TextDrawAlignment(MapaGTA8, 1);
    TextDrawColor(MapaGTA8, -624405505);
    TextDrawSetShadow(MapaGTA8, 1);
    TextDrawSetOutline(MapaGTA8, 0);
    TextDrawBackgroundColor(MapaGTA8, 255);
    TextDrawFont(MapaGTA8, 2);
    TextDrawSetProportional(MapaGTA8, 1);

    for(new i = 0; i < MAX_PLAYERS; i++)
    {

        TAXIMET[i] = TextDrawCreate(378.000000, 360.000000, "Taximetro");
        TextDrawBackgroundColor(TAXIMET[i], 255);
        TextDrawFont(TAXIMET[i], 1);
        TextDrawLetterSize(TAXIMET[i], 0.500000, 1.000000);
        TextDrawColor(TAXIMET[i], -1);
        TextDrawSetOutline(TAXIMET[i], 0);
        TextDrawSetProportional(TAXIMET[i], 1);
        TextDrawSetShadow(TAXIMET[i], 1);
        TextDrawUseBox(TAXIMET[i], 1);
        TextDrawBoxColor(TAXIMET[i], 255);
        TextDrawTextSize(TAXIMET[i], 494.000000, 230.000000);

        TAXIMET2[i] = TextDrawCreate(470.000000, 360.000000, "$0");
        TextDrawBackgroundColor(TAXIMET2[i], 255);
        TextDrawFont(TAXIMET2[i], 1);
        TextDrawLetterSize(TAXIMET2[i], 0.500000, 1.000000);
        TextDrawColor(TAXIMET2[i], -1);
        TextDrawSetOutline(TAXIMET2[i], 0);
        TextDrawSetProportional(TAXIMET2[i], 1);
        TextDrawSetShadow(TAXIMET2[i], 1);

        // Velocimetro y Taximetro

        santiago1[i] = TextDrawCreate(620.447937, 337.500030, "usebox");
        TextDrawLetterSize(santiago1[i], 0.000000, 4.609256);
        TextDrawTextSize(santiago1[i], 539.610473, 0.000000);
        TextDrawAlignment(santiago1[i], 1);
        TextDrawColor(santiago1[i], 0);
        TextDrawUseBox(santiago1[i], 1);
        TextDrawBoxColor(santiago1[i], 0x0B0B0BAA);
        TextDrawSetShadow(santiago1[i], 1);
        TextDrawSetOutline(santiago1[i], 0);
        TextDrawFont(santiago1[i], 0);

        santiago2[i] = TextDrawCreate(620.447998, 384.750000, "usebox");
        TextDrawLetterSize(santiago2[i], 0.000000, 4.544444);
        TextDrawTextSize(santiago2[i], 539.610534, 0.000000);
        TextDrawAlignment(santiago2[i], 1);
        TextDrawColor(santiago2[i], -1);
        TextDrawUseBox(santiago2[i], 1);
        TextDrawBoxColor(santiago2[i], 0x0B0B0BAA);
        TextDrawSetShadow(santiago2[i], 0);
        TextDrawSetOutline(santiago2[i], 0);
        TextDrawFont(santiago2[i], 0);

        santiago3[i] = TextDrawCreate(588.930725, 404.833251, "KM/h");
        TextDrawLetterSize(santiago3[i], 0.321155, 0.958333);
        TextDrawAlignment(santiago3[i], 1);
        TextDrawColor(santiago3[i], -1);
        TextDrawSetShadow(santiago3[i], 0);
        TextDrawSetOutline(santiago3[i], 1);
        TextDrawBackgroundColor(santiago3[i], 51);
        TextDrawFont(santiago3[i], 1);
        TextDrawSetProportional(santiago3[i], 1);

        santiago4[i] = TextDrawCreate(549.106384, 384.416839, "Velocimetro");
        TextDrawLetterSize(santiago4[i], 0.302412, 1.308332);
        TextDrawAlignment(santiago4[i], 1);
        TextDrawColor(santiago4[i], -1);
        TextDrawSetShadow(santiago4[i], 0);
        TextDrawSetOutline(santiago4[i], 1);
        TextDrawBackgroundColor(santiago4[i], 51);
        TextDrawFont(santiago4[i], 1);
        TextDrawSetProportional(santiago4[i], 1);

        santiago5[i] = TextDrawCreate(558.008972, 399.583282, "0");
        TextDrawLetterSize(santiago5[i], 0.449999, 1.600000);
        TextDrawAlignment(santiago5[i], 1);
        TextDrawColor(santiago5[i], -1);
        TextDrawSetShadow(santiago5[i], 0);
        TextDrawSetOutline(santiago5[i], 1);
        TextDrawBackgroundColor(santiago5[i], 51);
        TextDrawFont(santiago5[i], 1);
        TextDrawSetProportional(santiago5[i], 1);

        santiago6[i] = TextDrawCreate(546.296081, 337.166625, "Combustible");
        TextDrawLetterSize(santiago6[i], 0.321156, 1.424999);
        TextDrawAlignment(santiago6[i], 1);
        TextDrawColor(santiago6[i], -1);
        TextDrawSetShadow(santiago6[i], 0);
        TextDrawSetOutline(santiago6[i], 1);
        TextDrawBackgroundColor(santiago6[i], 51);
        TextDrawFont(santiago6[i], 1);
        TextDrawSetProportional(santiago6[i], 1);

        santiago7[i] = TextDrawCreate(548.638305, 352.333374, "0/100");
        TextDrawLetterSize(santiago7[i], 0.449999, 1.600000);
        TextDrawAlignment(santiago7[i], 1);
        TextDrawColor(santiago7[i], -1);
        TextDrawSetShadow(santiago7[i], 0);
        TextDrawSetOutline(santiago7[i], 1);
        TextDrawBackgroundColor(santiago7[i], 51);
        TextDrawFont(santiago7[i], 1);
        TextDrawSetProportional(santiago7[i], 1);

        TiempoBaul[i]   = CreateProgressBar(256.00, 289.00, 127.50, 4.19, 16711935, 100.0);

        speedbar[i]     = CreateProgressBar(546.00, 419.00, 67.50,  2.50, -8978177, 100.0);
        speedbar2[i]    = CreateProgressBar(546.00, 374.00, 67.50,  2.50, 10457087, 100.0);
        Descargando[i]  = CreateProgressBar(260.00, 355.00, 120.50, 3.20, 16711935, 100.0);

    }
}

Code CargarHouses()
pawn Code:
forward CargarHouses();
public CargarHouses()
{
    new Query[200];
    format(Query, sizeof(Query), "SELECT * FROM `propiedades`");
    mysql_function_query(Conecction, Query, true, "CargarCasas", "i", 3);
}

Code CargarFacciones()
pawn Code:
forward CargarFacciones();
public CargarFacciones()
{
    new Query[200];
    format(Query, sizeof(Query), "SELECT * FROM `facciones`");
    mysql_function_query(Conecction, Query, true, "CargarBandas", "i", 3);
}

Code CargarUsers()
pawn Code:
forward CargarUsers();
public CargarUsers()
{
    new Query[200];
    format(Query, sizeof(Query), "SELECT * FROM `registros`");
    mysql_function_query(Conecction, Query, true, "CargarRegistros", "i", 3);
}
Th3N0oB is offline   Reply With Quote
Old 11/11/2019, 05:56 AM   #2
Jstylezzz
High-roller
 
Jstylezzz's Avatar
 
Join Date: Sep 2011
Location: Netherlands
Posts: 1,859
Reputation: 1571
Default Re: [HELP] Run time error 4: "Array index out of bounds"

Is this the output using the crash detect plugin? If not, you might want to add that and use the correct compile flags (should be in the crashdetect thread). It might output more information for #0.

For #1, the first thing I look for when having the "Array index out of bounds" exception, are arrays. What is the size for your MAX_PLAYERS? In the for loop within 'CargarTodo' you access a variety of arrays. Are those all initialized using MAX_PLAYERS? If not, you might want to double check that.
If that all checks out, you might want to look through the following callbacks: CargarCasas, CargarBandas, CargarRegistros. Those are called after the queries for the three functions that are called first in CargarTodo.
If you use things like MAX_HOUSES etc, make sure that its size is at least as big as the amount of houses in your database.
Jstylezzz is offline   Reply With Quote
Old 11/11/2019, 06:08 AM   #3
Th3N0oB
Big Clucker
 
Join Date: Oct 2016
Location: Ecuador
Posts: 132
Reputation: 1
Default Re: [HELP] Run time error 4: "Array index out of bounds"

Quote:
Originally Posted by Jstylezzz View Post
Is this the output using the crash detect plugin? If not, you might want to add that and use the correct compile flags (should be in the crashdetect thread). It might output more information for #0.

For #1, the first thing I look for when having the "Array index out of bounds" exception, are arrays. What is the size for your MAX_PLAYERS? In the for loop within 'CargarTodo' you access a variety of arrays. Are those all initialized using MAX_PLAYERS? If not, you might want to double check that.
If that all checks out, you might want to look through the following callbacks: CargarCasas, CargarBandas, CargarRegistros. Those are called after the queries for the three functions that are called first in CargarTodo.
If you use things like MAX_HOUSES etc, make sure that its size is at least as big as the amount of houses in your database.
About MAX_PLAYERS, I found something, at the beginning of the gamemode, is this:
pawn Code:
#undef      MAX_PLAYERS
#define     MAX_PLAYERS         (250)

Can you have something to see?
Th3N0oB is offline   Reply With Quote
Old 11/11/2019, 06:48 AM   #4
Jstylezzz
High-roller
 
Jstylezzz's Avatar
 
Join Date: Sep 2011
Location: Netherlands
Posts: 1,859
Reputation: 1571
Default Re: [HELP] Run time error 4: "Array index out of bounds"

It at least shows that it goes nowhere near the 682 from the stack trace, so I'm guessing that our problem lies elsewhere. Good find!
I think it's a good idea to check the callbacks for the SQL queries next (CargarCasas, CargarBandas, CargarRegistros). Specifically, check whether the arrays you use in those callbacks (if any) are initialized big enough to accommodate for all rows you load from the database.
Jstylezzz is offline   Reply With Quote
Old 11/11/2019, 07:27 AM   #5
Calisthenics
Gangsta
 
Join Date: May 2018
Posts: 753
Reputation: 147
Default Re: [HELP] Run time error 4: "Array index out of bounds"

Compile with -d3 flag as Jstylezzz mentioned: https://github.com/Zeex/samp-plugin-...ith-debug-info

Update progressbar include: https://github.com/Southclaws/progress2

Quote:
Originally Posted by Jstylezzz View Post
I think it's a good idea to check the callbacks for the SQL queries next (CargarCasas, CargarBandas, CargarRegistros).
Public functions are always named in crashdetect logs. I tend to believe it has something to do with CreateProgressBar as parameters count matches too.
Calisthenics is offline   Reply With Quote
Old 11/11/2019, 07:39 PM   #6
Calisthenics
Gangsta
 
Join Date: May 2018
Posts: 753
Reputation: 147
Default Re: [HELP] Run time error 4: "Array index out of bounds"

The old `UpdateProgressBar` function only showed the progress bar to specified player or to all players if `playerid` was set to INVALID_PLAYER_ID. In the updated include version, the function is replaced internally by `_progress2_renderBar` function and shows the progress bar itself after creating or setting position/width/height/direction.
Calisthenics is offline   Reply With Quote
Old 11/11/2019, 08:58 PM   #7
Th3N0oB
Big Clucker
 
Join Date: Oct 2016
Location: Ecuador
Posts: 132
Reputation: 1
Default Re: [HELP] Run time error 4: "Array index out of bounds"

Quote:
Originally Posted by Calisthenics View Post
The old `UpdateProgressBar` function only showed the progress bar to specified player or to all players if `playerid` was set to INVALID_PLAYER_ID. In the updated include version, the function is replaced internally by `_progress2_renderBar` function and shows the progress bar itself after creating or setting position/width/height/direction.
pawn Code:
...\pawno\include\YSI_Data\y_foreach\..\..\YSI_Core\y_core\y_utils_impl.inc(428) : error 017: undefined symbol "isnull"
...\pawno\include\YSI_Data\y_foreach\..\..\YSI_Core\y_core\y_utils_impl.inc(428) : error 010: invalid function or declaration
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(513) : warning 219: local variable "actorid" shadows a variable at a preceding level
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(513) : warning 219: local variable "actorid" shadows a variable at a preceding level
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(513) : warning 219: local variable "actorid" shadows a variable at a preceding level
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(513) : warning 219: local variable "actorid" shadows a variable at a preceding level
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(541) : warning 219: local variable "actorid" shadows a variable at a preceding level
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(586) : warning 202: number of arguments does not match definition
...\pawno\include\geolocation.inc(474) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(2047) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(2178) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(2332) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(2340) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(14283) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(14312) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(16945) : warning 217: loose indentation
...\gamemodes\Test.pwn(18136) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(18641) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(19021) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(19387) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(20568) : warning 217: loose indentation
...\gamemodes\Test.pwn(20730) : warning 217: loose indentation
...\gamemodes\Test.pwn(23437) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(25011) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(25492) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(26047) : warning 217: loose indentation
...\gamemodes\Test.pwn(26063) : warning 217: loose indentation
...\gamemodes\Test.pwn(26143) : warning 217: loose indentation
...\gamemodes\Test.pwn(29513) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(40897) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(46746) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(53107) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(53188) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(53221) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(54039) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(54088) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(54103) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(54168) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(54185) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(54219) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(54239) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(54435) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(54489) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(54528) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(54567) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(54605) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(54643) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(54689) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
...\gamemodes\Test.pwn(16881) : warning 204: symbol is assigned a value that is never used: "RopaIconoProLaps"
Pawn compiler 3.10.8            Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.

That all started when I changed the 'progress' to the 'progress2', first I was asked to include de logeer, then YSI, then subfolders of YSI_Core, etc. etc., I decided to change all the YSI to the latest version, and that was the result.
Th3N0oB is offline   Reply With Quote
Old 11/11/2019, 09:00 PM   #8
Th3N0oB
Big Clucker
 
Join Date: Oct 2016
Location: Ecuador
Posts: 132
Reputation: 1
Default Re: [HELP] Run time error 4: "Array index out of bounds"

Quote:
Originally Posted by Jstylezzz View Post
It at least shows that it goes nowhere near the 682 from the stack trace, so I'm guessing that our problem lies elsewhere. Good find!
I think it's a good idea to check the callbacks for the SQL queries next (CargarCasas, CargarBandas, CargarRegistros). Specifically, check whether the arrays you use in those callbacks (if any) are initialized big enough to accommodate for all rows you load from the database.
Thank you, that I am trying to do, but first I want to rule out debug # 1 replacing the include 'progress' with the new 'progress2' but I got a lot of mistakes, I am waiting for an answer.
Th3N0oB is offline   Reply With Quote
Old 11/11/2019, 09:07 PM   #9
Calisthenics
Gangsta
 
Join Date: May 2018
Posts: 753
Reputation: 147
Default Re: [HELP] Run time error 4: "Array index out of bounds"

This is old and deprecated syntax of foreach:
pawn Code:
foreach(Player, i)
This is the new syntax:
pawn Code:
foreach(new i : Player)

Are you sure you have the latest version of YSI 5?
pawn Code:
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(586) : warning 202: number of arguments does not match definition
but line 586 is empty: https://github.com/pawn-lang/YSI-Inc...ators.inc#L586
Calisthenics is offline   Reply With Quote
Old 11/11/2019, 09:33 PM   #10
Th3N0oB
Big Clucker
 
Join Date: Oct 2016
Location: Ecuador
Posts: 132
Reputation: 1
Default Re: [HELP] Run time error 4: "Array index out of bounds"

Quote:
Originally Posted by Calisthenics View Post
This is old and deprecated syntax of foreach:
pawn Code:
foreach(Player, i)
This is the new syntax:
pawn Code:
foreach(new i : Player)

Are you sure you have the latest version of YSI 5?
pawn Code:
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(586) : warning 202: number of arguments does not match definition
but line 586 is empty: https://github.com/pawn-lang/YSI-Inc...ators.inc#L586
How strange, I am sure I have put the latest version of YSI, but hey, I downloaded the one you placed there in the comment, and I replaced it, so correcting the foreach thing, you are a true genius, but now I have these warnings:
pawn Code:
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(623) : warning 219: local variable "actorid" shadows a variable at a preceding level
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(623) : warning 219: local variable "actorid" shadows a variable at a preceding level
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(623) : warning 219: local variable "actorid" shadows a variable at a preceding level
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(623) : warning 219: local variable "actorid" shadows a variable at a preceding level
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(651) : warning 219: local variable "actorid" shadows a variable at a preceding level
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(668) : warning 219: local variable "actorid" shadows a variable at a preceding level
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(676) : warning 219: local variable "actorid" shadows a variable at a preceding level
...\pawno\include\YSI_Data\y_foreach\y_foreach_iterators.inc(714) : warning 202: number of arguments does not match definition
...\gamemodes\Test.pwn(16945) : warning 217: loose indentation
...\gamemodes\Test.pwn(20568) : warning 217: loose indentation
...\gamemodes\Test.pwn(20730) : warning 217: loose indentation
...\gamemodes\Test.pwn(26047) : warning 217: loose indentation
...\gamemodes\Test.pwn(26063) : warning 217: loose indentation
...\gamemodes\Test.pwn(26143) : warning 217: loose indentation
...\gamemodes\Test.pwn(16881) : warning 204: symbol is assigned a value that is never used: "RopaIconoProLaps"
Pawn compiler 3.10.8            Copyright (c) 1997-2006, ITB CompuPhase

Header size:          23660 bytes
Code size:          3792020 bytes
Data size:         37721588 bytes
Stack/heap size:      16384 bytes; estimated max. usage=5197 cells (20788 bytes)
Total requirements:41553652 bytes

15 Warnings.
Th3N0oB is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[debug] Run time error 4: "Array index out of bounds" problem MaestrulFritz Scripting Help 1 31/08/2019 12:14 PM
[debug] Run time error 4: "Array index out of bounds" nGen.SoNNy Scripting Help 3 06/03/2019 05:16 PM
Run time error 4: "Array index out of bounds" in Server Console! HAGAKURE Scripting Help 6 13/07/2016 10:18 PM
[debug] Run time error 4: "Array index out of bounds" and many more errors :P ntmp Scripting Help 2 11/08/2014 03:10 PM
Run time error 4: "Array index out of bounds" in public turftaking [SF]OutLawZ Scripting Help 1 01/08/2012 06:07 AM


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


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