AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Array index out of bounds (https://forums.alliedmods.net/showthread.php?t=195582)

kyriuch 09-09-2012 06:01

Array index out of bounds
 
Hey. Got problem with compiling. Help!

Debuger:

Code:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright © 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Input line too long (after substitutions) on line 452
Error: Array index out of bounds (variable "color1") on line 453
Warning: Loose indentation on line 464
Error: Undefined symbol "lentFootsteps" on line 464
Warning: Loose indentation on line 465
Error: Invalid expression, assumed zero on line 465
Warning: Expression has no effect on line 465
Warning: Loose indentation on line 467

4 Errors.
Could not locate output file C:\Program Files  (x86)\Steam\steamapps\jurigagarin25\dedicated  server\cstrike\addons\amxmodx\plugins\mm.amx (compile failed).

PHP Code:

ShowMainMenuSecond(id)
{
        new 
menu[512], Cost[g_Accesories], Level[g_Accesories],color1[3][g_Accesories],color2[3][g_Accesories];
        
        for(new 
0g_Accesories++)
        {
                if(
g_PlayerSkill[id][a] >= g_MaxAccesoriesLevel[a]) Level[a] = g_PlayerSkill[id][a];
                else 
Level[a] = g_PlayerSkill[id][a] + 1;
        }
        
        for(new 
0g_Accesories++)
        {
                if(
g_PlayerSkill[id][b] < g_MaxAccesoriesLevel[b]) Cost[b] = ( g_PlayerSkill[id][b] + ) * g_CostOfAccesories[b]
                else 
Cost[b] = 0
        
}
        
        for(new 
0g_Accesories++)
        {
                
color1[c] = g_PlayerMoney[id][Normal] < g_CostOfAccesories[c] ? "\d" "\w"
        
}
        
        for(new 
0g_Accesories++)
        {
                
color2[d] = g_PlayerMoney[id][Normal] < g_CostOfAccesories[d] ? "\d" "\w"
        
}
        
        
format(menucharsmax(menu),\
                
g_MainMenuSecond,\
                
PLUGIN_PREFIX,\
                
color1[Stealth],\
                
color2[Stealth],\
                
Level[Stealth],\
                
Level[Stealth] * g_AmountPerLevel[Stealth],\
                
Cost[Stealth],\
                
color1[FasterRunning],\
                
color2[FasterRunning],\
                
Level[FasterRunning],\
                
Level[FasterRunning] * g_AmountPerLevel[FasterRunning],\
                
Cost[FasterRunning],\
                
color1[DamageIncreaser],\
                
color2[DamageIncreaser],\
                
Level[DamageIncreaser],\
                
Level[DamageIncreaser] * g_AmountPerLevel[DamageIncreaser],\
                
Cost[DamageIncreaser],\
                
color1[SilentFootsteps],\
                
color2[SilentFootsteps],\
                
Cost[SilentFootsteps],\
                
color1[AntiFlash],\
                
color2[AntiFlash],\
                
Cost[AntiFlash],\
                
color1[AntiSmoke],\
                
color2[AntiSmoke],\
                
Cost[AntiSmoke],\
                
color1[NoPainShock],\
                
color2[NoPainShock],\
                
Cost[NoPainShock]
                );
                
        
show_menu(idg_MainMenuSecondKeysmenu, -1"MMMainMenuSecond");
}  
/// LINE 467 


ConnorMcLeod 09-09-2012 06:22

Re: Array index out of bounds
 
Code:

032      array index  out  of  bounds
          The array index is larger than the highest valid entry of the array.


Also, you don't need escape char when there is a comma.

Last, we can't guess what are lines numbers.

kyriuch 09-09-2012 06:27

Re: Array index out of bounds
 
I wrote that the last line is //467

ConnorMcLeod 09-09-2012 06:28

Re: Array index out of bounds
 
So we have to count back untill 453 ? you are kidding.
Also you use format native in a wrong way.
Is the plugin yours or do you make some edition ?


All times are GMT -4. The time now is 08:15.

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