Raised This Month: $ Target: $400
 0% 

Run time error 4: index out of bounds


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
faki
Senior Member
Join Date: Jul 2013
Old 05-22-2014 , 05:15   Run time error 4: index out of bounds
Reply With Quote #1

I have this:
Code:
#define TOTALLEVELS 12

new gEnt

new const Levels[TOTALLEVELS] = 
{
0,
50, 
100,
200,
300,
500,
750,
1000,
1250,
1500,
1750,
2000
}
new const LevelNames[TOTALLEVELS][] =
{
"NewBie",
"Beginner",
"Learning",
"Advanced",
"Ultimate",
"Kniffer",
"Killer",
"freak",
"PRO",
"Veteran",
"Respected",
"Matrix"
}
and this:
Code:
if( get_user_points(id) >= Levels[gLevel[id]] )
{
gLevel[id]++;
}
The line that makes the error is:
Code:
if( get_user_points(id) >= Levels[gLevel[id]] )
Its over the 2000 and makes the index out of bounds errors.
How to fix and if points of user is over 2000 to make last level without index out of bounds?

Last edited by faki; 05-22-2014 at 05:16.
faki 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 09:38.


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