Raised This Month: $ Target: $400
 0% 

[Help] index out of bounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 11-01-2011 , 08:28   [Help] index out of bounds
Reply With Quote #1

Someone help me to solve this problem
Code:
L 11/01/2011 - 19:22:05: [AMXX] Run time error 4: index out of bounds 
L 11/01/2011 - 19:22:05: [AMXX]    [0] bio_zclass_banshee.sma::Forward_AddToFullPack_Post (line 651)
L 11/01/2011 - 19:22:05: [AMXX] Displaying debug trace (plugin "bio_zclass_banshee.amx
Here is code
PHP Code:
new g_iConfusing[33], g_iEntFake[33]
new 
g_confusing[33]

public 
Forward_AddToFullPack_Post(es_handledinteenthosthostflagsplayerpSet)
{
    
// neu host ko con song thi bo qua
    
if (!is_user_alive(host))
        return 
FMRES_IGNORED
        
    
if(!g_confusing[host] || !g_iConfusing[host])
        return 
FMRES_IGNORED
    
    
// neu host ko bi dinh bomb hc thang attacker da chet
    
static iAttacker
    iAttacker 
g_iConfusing[host]
    if (!
iAttacker || iAttacker == host || !is_user_alive(iAttacker))
        return 
FMRES_IGNORED
        
    
// neu ent chinh la thang nem bomb
    
if ((ent 32) && is_user_zombie(ent))
    {
            
// an? thang do'
            
set_es(es_handledES_RenderModekRenderTransAdd)
            
set_es(es_handledES_RenderAmt0.0)
            
            
// tao ent fake cho attacker neu chua co
            
new iEntFake find_ent_by_owner(-1CLASSNAME_FAKE_PLAYERent)
            if(!
iEntFake || !pev_valid(ent))
            {
                
iEntFake create_fake_player(ent)
            }
            
            
g_iEntFake[ent] = iEntFake
    
}
    
    
// neu ent la fake player cua attack
    
if (ent == g_iEntFake[ent]) // HERE IS 651 LINE
    
{
        
// show hang' cho thang victim xem
        
set_es(es_handledES_RenderModekRenderNormal)
        
set_es(es_handledES_RenderAmt255.0)
        
        
// set model cua host cho ent fake
        
set_es(es_handledES_ModelIndexpev(hostpev_modelindex))
    }
    
    return 
FMRES_IGNORED

- I still check = "is_valid_ent" but still got error

Last edited by dias; 11-01-2011 at 08:36.
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 11-01-2011 , 10:02   Re: [Help] index out of bounds
Reply With Quote #2

PHP Code:
#define is_user_valid(%1) (1 <= %1 <= g_maxplayers) 
Use get_maxplayers() instead of hard coding 32..
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 11-01-2011 , 10:02   Re: [Help] index out of bounds
Reply With Quote #3

PHP Code:
    if (ent == g_iEntFake[ent]) // HERE IS 651 LINE 
- Not that

Last edited by dias; 11-01-2011 at 10:02.
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-01-2011 , 16:34   Re: [Help] index out of bounds
Reply With Quote #4

ent is obviously greater than 32. You need to handle that case and not index an array if it's larget than 32.
__________________
fysiks is offline
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 11-01-2011 , 19:16   Re: [Help] index out of bounds
Reply With Quote #5

PHP Code:
g_iEntFake[id] = iEntFake 
- This is ent of id, id only 1 ~ 32 ?

Last edited by dias; 11-01-2011 at 19:16.
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
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 14:24.


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