Raised This Month: $ Target: $400
 0% 

Run time error 4: index out of bounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GhostMan
Senior Member
Join Date: Jun 2012
Old 01-25-2013 , 14:55   Run time error 4: index out of bounds
Reply With Quote #1

Quote:
L 01/25/2013 - 17:04:52: Start of error session.
L 01/25/2013 - 17:04:52: Info (map "deathrun_blueoffice") (file "addons/amxmodx/logs/error_20130125.log")
L 01/25/2013 - 17:04:52: [AMXX] Displaying debug trace (plugin "dr_shop.amxx")
L 01/25/2013 - 17:04:52: [AMXX] Run time error 4: index out of bounds
L 01/25/2013 - 17:04:52: [AMXX] [0] dr_shop.sma::Hook_Deathmessage (line 1012)
PHP Code:
/* --| Event when player died */
public Hook_Deathmessage()
{
    
/* --| If plugin is on... */
    
if( get_pcvar_numgDrShopOn ) == )
    {
        
/* --| Get the killer and attacker */
        
new killer read_data);
        new 
victim read_data);

        
/* --| If player has died with world / trigger_hurt */
        
if( killer == victim )
        {
            return 
PLUGIN_HANDLED;
        }
        
        
/* --| Setting killer points when killed a enemy */
        
if(get_user_flags(killer) & ADMIN_LEVEL_H)
        {
            
gKillerPointskiller ] += get_pcvar_numgKillerPointsCvar ) * 2;
        }
        else
        {
            
gKillerPointskiller ] += get_pcvar_numgKillerPointsCvar );
        }
    
        
/* --| Reseting items */
        
if(!is_user_bot(victim))
        {
            
HasHevictim ] = false;
            
HasBothGrenvictim ] = false;
            
HasSilentvictim ] = false;
            
HasHealthvictim ] = false;
            
HasArmorvictim ] = false;
            
HasSpeedvictim ] = false;
            
HasGravityvictim ] = false;
            
HasInvisvictim ] = false;
            
HasNoclipvictim ] = false;
            
HasJetvictim ] = false;
            
HasDeaglevictim ] = false;
            
HasLongJumpvictim ] = false;
            
HasGlowvictim ] = false;
            
HasNVGvictim ] = false;
            
            
set_user_gravityvictim1.0 );    
            
set_user_maxspeedvictim0.0 );
            
set_user_footstepsvictim);
            
set_user_noclipvictim);
            
set_user_renderingvictim );
            
set_user_nvgvictim);
            
remove_user_nvgvictim );
            
remove_taskvictim );
        }
    }
    
    return 
PLUGIN_CONTINUE;

1012 line
PHP Code:
            HasHevictim ] = false
http://forums.alliedmods.net/showthread.php?t=87536
GhostMan is offline
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 01-25-2013 , 15:22   Re: Run time error 4: index out of bounds
Reply With Quote #2

Show us the register of varibles
__________________
simanovich is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-25-2013 , 16:05   Re: Run time error 4: index out of bounds
Reply With Quote #3

When posting error logs, you need to post the whole error (not all of the error lines have [AMXX]). Also, does this error occur when you run the original plugin? Your changes to this function should not have "created" this situation.
__________________
fysiks is offline
GhostMan
Senior Member
Join Date: Jun 2012
Old 01-25-2013 , 16:44   Re: Run time error 4: index out of bounds
Reply With Quote #4

You can see all changes that i'v done in this funcion. I saw this error when i was using the original plugin, that's why i added "if(!is_user_bot)".

All rest of the code is the same, you can download SMA here http://forums.alliedmods.net/attachm...0&d=1253106683
I'm not posting this issue there becouse it's "unaproved/old plugin" so i think i wont get any help from the author.
GhostMan is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-25-2013 , 16:58   Re: Run time error 4: index out of bounds
Reply With Quote #5

Anytime you have an index out of bounds, you need to know what the value of the index when the error occurs. Typically, I wouldn't check if a victim is a player but maybe you need to do that.
__________________

Last edited by fysiks; 01-25-2013 at 16:58.
fysiks is offline
GhostMan
Senior Member
Join Date: Jun 2012
Old 01-26-2013 , 09:09   Re: Run time error 4: index out of bounds
Reply With Quote #6

I see in that deathrun plugin values are reseted two times:
1. On player death
2. On new round

I have removed part where values are reset on player's death and did that not on new round, but on player's spawn.

I'v been getting this error when values were reset on player's death, now it's completely removed so i will see how it goes.

By the way. In this deathrun plugin i can see these parts
PHP Code:
public client_disconnectid )
{
    
HasHeid ] = false;
    
HasBothGrenid ] = false;
    
HasSilentid ] = false;
    
HasHealthid ] = false;
    
HasArmorid] = false;
    
HasSpeedid ] = false;
    
HasGravityid ] = false;
    
HasInvisid ] = false;
    
HasNoclipid ] = false;
    
HasJetid ] = false;
    
HasDeagleid ] = false;
    
HasLongJumpid ] = false;
    
HasGlowid ] = false;
    
HasNVGid ] = false;

PHP Code:
public client_connectid )
{
    
HasHeid ] = false;
    
HasBothGrenid ] = false;
    
HasSilentid ] = false;
    
HasHealthid ] = false;
    
HasArmorid] = false;
    
HasSpeedid ] = false;
    
HasGravityid ] = false;
    
HasInvisid ] = false;
    
HasNoclipid ] = false;
    
HasJetid ] = false;
    
HasDeagleid ] = false;
    
HasLongJumpid ] = false;
    
HasGlowid ] = false;
    
HasNVGid ] = false;

All variables are deleted when player disconnects, aren't they? So this part is completely useless and does no effect at all, isn't it?
GhostMan is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-26-2013 , 22:11   Re: Run time error 4: index out of bounds
Reply With Quote #7

Quote:
Originally Posted by GhostMan View Post
By the way. In this deathrun plugin i can see these parts
PHP Code:
public client_disconnectid )
{
    
HasHeid ] = false;
    
HasBothGrenid ] = false;
    
HasSilentid ] = false;
    
HasHealthid ] = false;
    
HasArmorid] = false;
    
HasSpeedid ] = false;
    
HasGravityid ] = false;
    
HasInvisid ] = false;
    
HasNoclipid ] = false;
    
HasJetid ] = false;
    
HasDeagleid ] = false;
    
HasLongJumpid ] = false;
    
HasGlowid ] = false;
    
HasNVGid ] = false;

PHP Code:
public client_connectid )
{
    
HasHeid ] = false;
    
HasBothGrenid ] = false;
    
HasSilentid ] = false;
    
HasHealthid ] = false;
    
HasArmorid] = false;
    
HasSpeedid ] = false;
    
HasGravityid ] = false;
    
HasInvisid ] = false;
    
HasNoclipid ] = false;
    
HasJetid ] = false;
    
HasDeagleid ] = false;
    
HasLongJumpid ] = false;
    
HasGlowid ] = false;
    
HasNVGid ] = false;

All variables are deleted when player disconnects, aren't they? So this part is completely useless and does no effect at all, isn't it?
Those two may or may not be redundant depending on how they are used in the code. It is most likely redundant but the performance difference will be negligible.
__________________
fysiks is offline
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

Forum Jump


All times are GMT -4. The time now is 20:34.


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