Raised This Month: $51 Target: $400
 12% 

Run time error 4: index out of bounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 08-01-2015 , 08:09   Run time error 4: index out of bounds
Reply With Quote #1

Hello,

In logs constantly spamming:
Code:
L 08/01/2015 - 11:27:03: Start of error session.
L 08/01/2015 - 11:27:03: Info (map "jb_easynsimple_v3") (file "addons/amxmodx/logs/error_20150801.log")
L 08/01/2015 - 11:27:03: [AMXX] Displaying debug trace (plugin "jbe_dm_hideandseek.amxx", version "1.8.3-dev+4828")
L 08/01/2015 - 11:27:03: [AMXX] Run time error 4: index out of bounds 
L 08/01/2015 - 11:27:03: [AMXX]    [0] Untitled.sma::HandleChooseColor (line 240)
Code, line 240 is bold:
Quote:
new g_iFlashlightColors[][3] = { {255, 0, 0}, {0, 255, 0}, {0, 0, 255}, {255, 69, 0}, {0, 255, 255}, {255, 255, 0}, {255, 0, 255}, {255, 255, 255} };

public HandleChooseColor(id, menu, item) {
if(item == MENU_EXIT || !g_iFmCmdStart || userTeam(id) != 1 || !userAlive(id)) return;

static szColor[32], iBitAccess, iCallback, szData[2], szName[32];
menu_item_getinfo(menu, item, iBitAccess, szData, 1, szColor, 31, iCallback);
get_user_name(id, szName, 31);

set_user_rendering(id, kRenderFxGlowShell, g_iFlashlightColors[item][0], g_iFlashlightColors[item][1], g_iFlashlightColors[item][2], kRenderNormal, 1);
ColorChat(id, "Chowany", "Wybrales kolor^4 %s^1%s", szColor, item == MENU_TIMEOUT ? " po czasie, mozesz zostac zabity!" : ".");

for(new i = 1; i <= MaxClients; ++i) {
if(!userAlive(i) || userTeam(i) != 2) continue;

if(item == MENU_TIMEOUT) ColorChat(i, "Chowany", "^3%s^1 wybral kolor^4 %s^3 po czasie^1, mozesz zabic!", szName, szColor);
ColorChat(i, "Chowany", "^3%s^1 wybral kolor^4 %s^1. Jesli gracz zgadl kolor to naceluj na niego i nacisnij TAB", szName, szColor);
}
}
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-01-2015 , 08:56   Re: Run time error 4: index out of bounds
Reply With Quote #2

Have you added menu items to this? There are colors defined for 8 (index 0-7), when a higher value is passed into the array g_iFlashlightColors, that error will happen.
__________________

Last edited by Bugsy; 08-01-2015 at 08:58.
Bugsy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-01-2015 , 09:10   Re: Run time error 4: index out of bounds
Reply With Quote #3

"item" likely holds a negative value, like MENU_TIMEOUT (-4), you have some logic issue there.
__________________
Arkshine is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 06:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode