AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Invalid cellvector handle provided (https://forums.alliedmods.net/showthread.php?t=204550)

LeeanAndNeka 12-31-2012 16:03

Invalid cellvector handle provided
 
well a friend send me it because he had problems with his buy menu
I don't understand why happend it

ERROR:
Quote:

L 12/31/2012 - 17:05:26: Invalid cellvector handle provided (142:6:6)
L 12/31/2012 - 17:05:26: [AMXX] Displaying debug trace (plugin "zombie.amxx")
L 12/31/2012 - 17:05:26: [AMXX] Run time error 10: native error (native "ArrayGetCell")
L 12/31/2012 - 17:05:26: [AMXX] [0] zombie.sma::menu_buy1 (line 4590)
Menu_buy1:
PHP Code:

public menu_buy1(idkey)
{
    
// Player dead?
    
if (!g_isalive[id])
        return 
PLUGIN_HANDLED;
    
    
// Zombies or survivors get no guns
    
if (g_zombie[id] || g_survivor[id])
        return 
PLUGIN_HANDLED;
    
    
// Special keys / weapon list exceeded
    
if (key >= MENU_KEY_AUTOSELECT || WPN_SELECTION >= WPN_MAXIDS)
    {
        switch (
key)
        {
            case 
MENU_KEY_NEXT// next/back
            
{
                if (
WPN_STARTID+WPN_MAXIDS)
                    
WPN_STARTID += 7
                
else
                    
WPN_STARTID 0
            
}
            case 
MENU_KEY_EXIT// exit
            
{
                return 
PLUGIN_HANDLED;
            }
        }
        
        
// Show buy menu again
        
show_menu_buy1(id)
        return 
PLUGIN_HANDLED;
    }
    
    
// Store selected weapon id
    
WPN_AUTO_PRI WPN_SELECTION
    
    
new weplvlwepreset
    weplvl 
ArrayGetCellg_weplvl[0], WPN_SELECTION )
    
wepreset ArrayGetCellg_wepreset[0], WPN_SELECTION )
    
    
// Buy primary weapon
    
if( g_reset[id] > wepreset || (g_level[id] >= weplvl && g_reset[id] == wepreset) )
        
buy_primary_weapon(idWPN_AUTO_PRI)
    else if( 
g_reset[id] < wepreset || g_level[id] < weplvl)
    {
        
zp_colored_print(id"^x04[ZP]^x01 No cumples con los requisitos de esa arma")
        
show_menu_buy1(id)
        return 
PLUGIN_HANDLED
    
}
    
    
// Show pistols menu
    
show_menu_buy2(id)
    
    return 
PLUGIN_HANDLED;


sorry for my bad english, i'm on holidays (?

Arkshine 12-31-2012 16:10

Re: Invalid cellvector handle provided
 
"out of bound" issue. Your array has as size 6 (so item goes from index 0 to 5) and you're asking the item 6, which is > size of array. WPN_SELECTION is most likely wrong.


All times are GMT -4. The time now is 13:46.

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