Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 04:02

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



how i fix this error in c# 5165

Discussion on how i fix this error in c# 5165 within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2007
Posts: 48
Received Thanks: 2
how i fix this error in c# 5165

how i fix this error
bogy_king is offline  
Old 01/15/2010, 01:04   #2


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
Apparently your server is trying to access something which is outside the bounds of an Item Drop array.

Example:

Code:
            ItemDrop[] _Array = new ItemDrop[10];
            [COLOR="Red"][B]Item _NewItem = _Array[30];[/B][/COLOR]
The red line would throw the same exception because there are not 30 objects inside the array, there are only 10.

Put a breakpoint in at line 713 and see what is happening on that line.
Korvacs is offline  
Old 01/15/2010, 01:11   #3
 
elite*gold: 0
Join Date: Nov 2007
Posts: 48
Received Thanks: 2
Quote:
Originally Posted by Korvacs View Post
Apparently your server is trying to access something which is outside the bounds of an Item Drop array.

Example:

Code:
            ItemDrop[] _Array = new ItemDrop[10];
            [COLOR="Red"][B]Item _NewItem = _Array[30];[/B][/COLOR]
The red line would throw the same exception because there are not 30 objects inside the array, there are only 10.

Put a breakpoint in at line 713 and see what is happening on that line.
this screen in line 713 and i dont know what i diong please help me

bogy_king is offline  
Old 01/15/2010, 01:25   #4


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
Code:
                        if (From != null)
                        {
                            byte Tries = (byte)Rnd.Next(0, From.Count);
                            ItemID = (uint)From[Tries - 1];
                        }
That should be fine now.
Korvacs is offline  
Old 01/15/2010, 01:31   #5
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
Completely off topic: Congrats on getting mod Korvacs, you deserve it!
pro4never is offline  
Thanks
1 User
Old 01/15/2010, 02:26   #6
 
elite*gold: 0
Join Date: Nov 2007
Posts: 48
Received Thanks: 2
Quote:
Originally Posted by Korvacs View Post
Code:
                        if (From != null)
                        {
                            byte Tries = (byte)Rnd.Next(0, From.Count);
                            ItemID = (uint)From[Tries - 1];
                        }
That should be fine now.
tnx very much but what i doing now i dont know
bogy_king is offline  
Old 01/15/2010, 02:44   #7
 
NoFatChicks's Avatar
 
elite*gold: 0
Join Date: Dec 2009
Posts: 62
Received Thanks: 0
Quote:
Originally Posted by bogy_king View Post
tnx very much but what i doing now i dont know
Just read what him said and then.. read ur Mob.cs lines.
NoFatChicks is offline  
Old 01/15/2010, 03:08   #8
 
elite*gold: 0
Join Date: Nov 2007
Posts: 48
Received Thanks: 2
Quote:
Originally Posted by Korvacs View Post
Code:
                        if (From != null)
                        {
                            byte Tries = (byte)Rnd.Next(0, From.Count);
                            ItemID = (uint)From[Tries - 1];
                        }
That should be fine now.
the same problem not complete and make again see
bogy_king is offline  
Old 01/15/2010, 09:54   #9


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
Have you made any modifications to the source?
Korvacs is offline  
Old 01/15/2010, 10:12   #10
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,338
Received Thanks: 490
i bet he has i dont have this error at all not even when i scatter like 5k birdmans n they drop much much items
~Yuki~ is offline  
Old 01/15/2010, 12:38   #11
 
elite*gold: 0
Join Date: Nov 2007
Posts: 48
Received Thanks: 2
then how i fix it
bogy_king is offline  
Old 01/15/2010, 16:29   #12
 
elite*gold: 0
Join Date: Jan 2008
Posts: 43
Received Thanks: 1
if u run on x64 bit try to do it to run in x32bit ..

See this thread:
alexik is offline  
Old 01/16/2010, 00:04   #13
 
InfamousNoone's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,882
Quote:
Originally Posted by Korvacs View Post
Code:
                        if (From != null)
                        {
                            byte Tries = (byte)Rnd.Next(0, From.Count);
                            ItemID = (uint)From[Tries - 1];
                        }
That should be fine now.
(Bear in mind this isn't directed at you Korvacs, I'd never baby a post like this if it was lol)

The return value on Random.Next returns:
>=min, <max
Meaning it should never *logically* produce a number that wouldn't suffice as an index. HOWEVER! There are exceptions to this rule, where is the max is 0, 0 will be returned. So what if the Length of the array is 0, we can't index 0; now can we? So therefore logically From[0] would produce an exception where From.Length is 0.

So the solution would be

Code:
                
                        if (From.Length > 0)
                            ItemID = (uint)From[Rnd.Next(From.Count)];
Get rid of the whole if (From != null) scope. When would From ever equal null when we initialize it just a couple lines before our if-statement and never set it back to null.
InfamousNoone is offline  
Old 01/16/2010, 00:15   #14
 
elite*gold: 0
Join Date: Nov 2007
Posts: 48
Received Thanks: 2
then i removed this
if (From != null)
{
byte Tries = (byte)Rnd.Next(0, From.Count);
ItemID = (uint)From[Tries - 1];
}
and put this

if (From.Length > 0)
ItemID = (uint)From[Rnd.Next(From.Count)];
bogy_king is offline  
Old 01/16/2010, 01:05   #15


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
Quote:
Originally Posted by InfamousNoone View Post
(Bear in mind this isn't directed at you Korvacs, I'd never baby a post like this if it was lol)
Its fine, it was in the middle of the night when i posted that reply, i didnt think alot about it at the time lol
Korvacs is offline  
Reply


Similar Threads Similar Threads
Error in the Console 5165
07/11/2010 - CO2 Private Server - 8 Replies
hi, i have a co pserver 5165 non-hamachi i got an error, i can't login , it block in "login to game server" and take a look at the Console http://img188.imageshack.us/img188/4123/errorqo.p ng And here is my GameWorker.cs: using System;
Error with 5165
06/23/2010 - CO2 Private Server - 7 Replies
I get this error when i debug the project in c# http://img139.imageshack.us/img139/6204/errorcy.j pg Any idea how can i fix this? Edit: I'm getting another error when a char log in http://img28.imageshack.us/img28/4418/error2zh.jp g
5165 Error!
03/04/2010 - CO2 Private Server - 4 Replies
I followed Korvacs guide to run a 5165 server on Windows 7. Afterwards I tried to run the server, it got to the point where it says "Dmaps loaded successfully in 208 milliseconds" At that point it will go back to Visual C# and highlight In DMap.cs line 124 I need help.
5165 Error X_X
02/20/2010 - CO2 Private Server - 1 Replies
Aite since i like aint a decent coder, I got a error on ma source The name 'Skill' does not exist in this current context It was for the Reflect Fix Release, for (int n = 0; n < 5; n++) { BW.Write((byte)0);//WH Count
[Help] plz what is that error 5165
12/31/2009 - CO2 Private Server - 11 Replies
when im made my server non hamachi in 5165 thats give me that error when any one try to logging to my server and he can't log and im changed the source and still same prop http://i46.tinypic.com/1zvu99s.jpg



All times are GMT +2. The time now is 04:02.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.