2d array index out of bounds
PHP Code:
Code:
error 032: array index out of bounds (variable "g_PlayerData") |
Re: 2d array index out of bounds
It compiles fine for me.
|
Re: 2d array index out of bounds
What you posted is correct as HamletEagle says. But I see you have '...' after nick so there may be something you removed that is causing the error. You need to post full code if you want to get an answer.
|
Re: 2d array index out of bounds
PHP Code:
|
Re: 2d array index out of bounds
When I removed "= false" from the three booleans it worked.
Nothing actually wrong, so I'm gonna guess the compiler has a hard time interpreting in this case. Enums are always a bit weird, keep them as simple as possible. Booleans are always initialized as false. Code:
|
Re: 2d array index out of bounds
Thank you so much, now it works...
|
Re: 2d array index out of bounds
That was definitely the problem. The enumerator is really just a 'sizer' for an array so setting it to false does not make sense. The enum provides you offsets based on items preceding it, making it easy and fast to work with constants/variable-names to access items in an array. Setting to false for something would need to be done on the g_PlayerData[] array that was sized by playerTable.
The enum items in playerTable hold the below values. If the compiler allowed this, doing "isOnline = false" would change its value from 125 to 0 which essentially would over-write data where 'nick' is stored. nick=0 steamID=32 password=77 language=122 isOnline=125 isVip=126 isAdmin=127 bcoins = 128 |
Re: 2d array index out of bounds
Just one more question: How to get number of not empty rows in array ?
PHP Code:
|
Re: 2d array index out of bounds
Change achievements[50][achievementsTable] to achievements[5][achievementsTable]? Or do you mean the specific player?
If it's the player who only has 5, whatever stores his achievements, do a if ( player variable ) { add to menu } |
Re: 2d array index out of bounds
No, no.. I'm getting achievements from database and I should change [50] to [] because I dont know number of achiements and I always can add more..
|
| All times are GMT -4. The time now is 07:35. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.