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

Solved weird Index out of bounds


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
JocAnis
Veteran Member
Join Date: Jun 2010
Old 05-23-2020 , 20:14   weird Index out of bounds
Reply With Quote #1

Hi guys, im getting Index out of bounds, but i cant see any error/warning in the code, could be that a enum problem?

Code:
Code:
enum _:eModels
{
    MODEL_NAME[100],
    MODEL_LOCATION[100],
    MODEL_COST
}
new const ModelItems[][ eModels ] =
{
    { "Default", "gign", 0 },
    { "Agent Smith", "agent", 1000 },
    { "Terminator", "terminator", 1500 }
}
public fwSpawn_Post( id )
{
    if( is_user_bot( id ) || is_user_hltv( id ) )
        return

    if( is_user_alive( id ) )
    {
        set_task( 0.1, "check_model", id + 234 ) //pretty sure set task is not needed, but same error both situations
    }
}
public check_model( task )
{
    new id = task - 234

    if( cs_get_user_team( id ) == CS_TEAM_CT )
    {
        if( g_iModelSelected[ id ] > 0 )
            cs_set_user_model( id, ModelItems[ g_iModelSelected[ id ] ][ MODEL_LOCATION ] ) //this line is giving the warning
    }
    else if( cs_get_user_team( id ) == CS_TEAM_T )
        cs_set_user_model( id, "richtr" )
}
public client_putinserver( id )
{
    g_iModelSelected[ id ] = 0
}
public client_disconnedted( id )
{
    g_iModelSelected[ id ] = 0
}
Thanks in advance
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)

Last edited by JocAnis; 05-23-2020 at 21:25.
JocAnis is offline
 



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 04:37.


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