Run time error 4: Array index out of bounds
#1

Hi, i want to test a gamemode that i found and i get a problem that i get in mine but i fixed it easy, this is more difficult, i dont find the error

Quote:

[debug] Run time error 4: "Array index out of bounds"
[debug] Accessing element at index 682 past array upper bound 681
[debug] AMX backtrace:
[debug] #0 0000352c in Bar:CreateProgressBar (Float=1.00000, Float:y=444.00000, Float:width=638.50000, Float:height=2.50000, color=-1802267649, Float:max=100.00000) at C:\Reality Roleplay\gm\asdasd\GameMode\pawno\include\progress .inc:71
[debug] #1 000aa490 in public cargartodo () at C:\Reality Roleplay\gm\gmniceca\GameMode\gamemodes\OC.pwn:872 2


Si its say the error is in progress.inc include and gamemode line 8722..


Gamemode line 8722:

PHP код:
    XP[i]            = CreateProgressBar(1.00444.00638.502.50, -1802267649100.0); 
progress.inc line 71:
PHP код:
stock Bar:CreateProgressBar(Float:xFloat:yFloat:width=55.5Float:height=3.2colorFloat:max=100.0)
{
    new
        
barid;
    for(
barid 0barid sizeof Bars; ++barid)
        if(!
Bars[barid][pb_created]) break;
    if(
Bars[barid][pb_created] || barid == sizeof Bars// HERE, maybe i have to update progress inc?
        
return INVALID_BAR_ID;
    new 
Text:in_t Bars[barid][pb_t1] = TextDrawCreate(xy"_");
    
TextDrawUseBox        (in_t1);
    
TextDrawTextSize    (in_twidth0.0);
    
TextDrawLetterSize    (in_t1.0height 10);
    
TextDrawBoxColor    (in_t0x00000000 | (color 0x000000FF));
    
in_t Bars[barid][pb_t2] = TextDrawCreate(1.22.15"_");
    
TextDrawUseBox        (in_t1);
    
TextDrawTextSize    (in_twidth 2.00.0);
    
TextDrawLetterSize    (in_t1.0height 10 0.35);
    
TextDrawBoxColor    (in_t, (color 0xFFFFFF00) | (0x66 & ((color 0x000000FF) / 2)));
    
in_t Bars[barid][pb_t3] = TextDrawCreate(1.22.15"_");
    
TextDrawTextSize    (in_tpb_percent(xwidthmax1.0), 0.0);
    
TextDrawLetterSize    (in_t1.0height 10 0.35);
    
TextDrawBoxColor    (in_tcolor); 
Bars[barid][pb_x] = x;
Bars[barid][pb_y] = y;
Bars[barid][pb_w] = width;
Bars[barid][pb_h] = height;
Bars[barid][pb_m] = max;
Bars[barid][pb_color] = color;
Bars[barid][pb_created] = true;
return Bar:barid;
}


thank you again..
Reply
#2

Show the loop before
XP[i] = ...
Reply
#3

Quote:
Originally Posted by DBZdabIt3Bro7
Посмотреть сообщение
Show the loop before
XP[i] = ...
PHP код:
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        
NotiConnect[i][0] = TextDrawCreate(13.000000265.911041"box");
        
TextDrawLetterSize(NotiConnect[i][0], 0.0000004.799999);
        
TextDrawTextSize(NotiConnect[i][0], 182.0000000.000000);
        
TextDrawAlignment(NotiConnect[i][0], 1);
        
TextDrawColor(NotiConnect[i][0], -1);
        
TextDrawUseBox(NotiConnect[i][0], 1);
        
TextDrawBoxColor(NotiConnect[i][0], 255);
        
TextDrawSetShadow(NotiConnect[i][0], 0);
        
TextDrawSetOutline(NotiConnect[i][0], 0);
        
TextDrawBackgroundColor(NotiConnect[i][0], 255);
        
TextDrawFont(NotiConnect[i][0], 0);
        
TextDrawSetProportional(NotiConnect[i][0], 1);
        
TextDrawSetShadow(NotiConnect[i][0], 0); 
is the loop with a lot of textdraws, then the progressbar, :S
Reply
#4

Show the bars array.
Reply
#5

Quote:
Originally Posted by DBZdabIt3Bro7
Посмотреть сообщение
Show the bars array.
Its not array, its


Anyways fuck that gamemode i won't try that shit, no problem my friend thanks anyway

PHP код:
new Bar:XP[MAX_PLAYERS], Bar:speedbar2[MAX_PLAYERS], Bar:speedbar[MAX_PLAYERS], Bar:Barrased[MAX_PLAYERS], Bar:Barrahambre[MAX_PLAYERS]; 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)