Run time error 4: index out of bounds
Code:
Run time error 4: index out of bounds Code:
public menuitem_callbackc( id, menu, item ) |
Re: Run time error 4: index out of bounds
We can't help without see what this Skin_Info and g_PlayerKnives means. This error happens because the array's size is less than that check. Show us how you defined they.
|
Re: Run time error 4: index out of bounds
Code:
new g_PlayerKnives[ MAX_PLAYERS + 1 ][ enumKnifes ];Code:
enum _:enumKnifesCode:
new const Skin_Info[ enumSkins ][ enumSkinInfo ] = |
Re: Run time error 4: index out of bounds
The problem is not that "Skin_Info[ item ][ SKIN_KNIFE ]" is -1. It is that "item", id, the value of Player[] or Skin_Info[] is negative or larger than the array size.
How to debug your code in 5 minutes: Print everything. Code:
Code:
If you are still unsure, post the result of those messages here. |
Re: Run time error 4: index out of bounds
@Black Rose thank you. it helped
now i have new error: Quote:
Code:
stock ColorPrint( const index, const string[], any:... )Code:
GetPosition(Client) |
Re: Run time error 4: index out of bounds
Most likely you have a line with ColorPrint() where you don't have the same number of format placeholders (%d, %i, %f, %c, %s, %x, %a whatever) and arguments following.
Check out the line that the debug message is pointing at. And just as a side note, use charsmax() instead of manually entering 31 when working with strings. |
Re: Run time error 4: index out of bounds
Quote:
ArrayGetString(g_SteamID, Position, charsmax (SteamID))? - debug message is pointing at. its the stock of colorprint |
Re: Run time error 4: index out of bounds
The debug usually points to several things.
Here's an example. Code:
Code:
L 02/12/2017 - 16:49:22: String formatted incorrectly - parameter 3 (total 2)It points to line 11 and line 6. Line 11 is where the error occurs but the cause of the problem is at line 6 where I have not supplied enough arguments for the format. |
Re: Run time error 4: index out of bounds
@Black_Rose
ok i think the error come from ColorPrint, i will try client_print_color and can u example about charsmax how Quote:
|
Re: Run time error 4: index out of bounds
You're missing my point. The function is not the problem. It's how you used it. If you change to client_print_color() you will have the same problem.
You are right, but you just missed to enter SteamID before charsmax(SteamID). |
| All times are GMT -4. The time now is 20:44. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.