Raised This Month: $ Target: $400
 0% 

[Help] This code runtime errors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-22-2015 , 17:22   Re: [Help] This code runtime errors
Reply With Quote #1

I think I see it. You are sending a g_szShopData index to be used in an array that is sized by g_szKnifeData (these sizes are not the same nor are they related).
__________________
fysiks is offline
happy_2012
Senior Member
Join Date: Aug 2012
Old 11-22-2015 , 17:41   Re: [Help] This code runtime errors
Reply With Quote #2

Quote:
Originally Posted by fysiks View Post
I think I see it. You are sending a g_szShopData index to be used in an array that is sized by g_szKnifeData (these sizes are not the same nor are they related).
If you say so, where is that exactly?

I have also noticed that when someone buy the knife it say:
[ES] You have just bought: Butcher Knife

but it doesn't say:
[ES] Type /knife to choose your new knife

I am really confused with this, other items work smoothly, but knives do not.
__________________
Discord contacts:
I rarely look at private messages here, but I am very active on Discord!
happy_2012 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-22-2015 , 18:06   Re: [Help] This code runtime errors
Reply With Quote #3

It took me a while to find it because I didn't write the code and the fact that you abstracted so much code made it harder. So, since you wrote the code and understand the logic you were using, you should be able to find it much quicker than I did.

Did you do what I told you to do originally? Find the value that was causing the out of bounds error (I'm sure it's Item) and track that value backward through the code to see where it comes from. You should find that the value of Item is coming from the shop data and not the knife data array.

If I feel generous when I get home later, I might try and explain it if possible.
__________________
fysiks is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-22-2015 , 19:22   Re: [Help] This code runtime errors
Reply With Quote #4

For the third time . . . what is the value of the index that is causing the out of bounds error? (I'm quite sure that the variable in question is Item)


I bet the value is 16 for Assassin Knife, 17 for Light Knife, 18 for Butcher Knife, and 19 for Katana Knife. None of these values are valid indices for the second dimension of g_bKnifePurchased. In fact, if you work your way backwards (find where these functions are called), you'll notice that you are giving it a shop data index (and not a knife data index).
__________________
fysiks is offline
happy_2012
Senior Member
Join Date: Aug 2012
Old 11-23-2015 , 15:04   Re: [Help] This code runtime errors
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
For the third time . . . what is the value of the index that is causing the out of bounds error? (I'm quite sure that the variable in question is Item)


I bet the value is 16 for Assassin Knife, 17 for Light Knife, 18 for Butcher Knife, and 19 for Katana Knife. None of these values are valid indices for the second dimension of g_bKnifePurchased. In fact, if you work your way backwards (find where these functions are called), you'll notice that you are giving it a shop data index (and not a knife data index).
So if you are right, why I couldn't find anything like that? I checked every line over and over again, but found nothing? Perhaps I am too bad at finding errors, and correct them, can you help further? Like trying to fix the code if you are sure about your claim?
__________________
Discord contacts:
I rarely look at private messages here, but I am very active on Discord!
happy_2012 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-23-2015 , 20:00   Re: [Help] This code runtime errors
Reply With Quote #6

For the fourth time . . . what is the value of the index that is causing the out of bounds error?

Tell me the actual value when the error occurs. To make it easier for you, tell me both the value of "Index" and "Item" in the function when the error occurs.

I am 98% sure that I'm correct but without the information that I've asked for, 4 times now, I can't be 100% sure.
__________________
fysiks is offline
happy_2012
Senior Member
Join Date: Aug 2012
Old 11-24-2015 , 02:31   Re: [Help] This code runtime errors
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
For the fourth time . . . what is the value of the index that is causing the out of bounds error?

Tell me the actual value when the error occurs. To make it easier for you, tell me both the value of "Index" and "Item" in the function when the error occurs.

I am 98% sure that I'm correct but without the information that I've asked for, 4 times now, I can't be 100% sure.
I copied the whole error, it doesnt show values ��

[Edit]
I updated the plugin, I moved the knives up to the top of g_szShopData[ ][ ] constant, moved CATEGORY_KNIVES to the top of it's enumeration, and category name "Knives", to the top, and all worked fine. So I suppose you were right about that it was Item variable was causing the problem, but I think there would be another fix for this problem?
__________________
Discord contacts:
I rarely look at private messages here, but I am very active on Discord!

Last edited by happy_2012; 11-24-2015 at 09:29.
happy_2012 is offline
Reply



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 18:12.


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