Register for your free account! | Forgot your password?

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

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

Advertisement



Can i ask about this for 5369 source

Discussion on Can i ask about this for 5369 source within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
marlyandedsel's Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 343
Received Thanks: 21
Can i ask about this for 5369 source

I have this error I dunno what the cause can you tell me what to do please

I have here the image.
Attached Images
File Type: jpg errorline.jpg (743.3 KB, 46 views)
marlyandedsel is offline  
Old 05/13/2011, 17:13   #2
 
12tails's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 782
Received Thanks: 458
for ***... kill yourself....

if you just read the error you would know the answer....

this mean that you added or removed a value from the collection while doing an operation... for example using the foreach...
12tails is offline  
Thanks
2 Users
Old 05/13/2011, 18:31   #3
 
{ Angelius }'s Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
some extra info on what 12tails just said ,
The problem is that, if you are doing a foreach loop over a collection, and another thread modifies the collection, the enumerator used in foreach is no longer valid. This will cause an exception to throw at that point.

on how to fix it.

you can do something like this .

Quote:
static public Dictionary<T, T2> ThreadSafeDictionary<T, T2>(this Dictionary<T, T2> dictionary)
{
Dictionary<T, T2> copy;
Monitor.Enter(dictionary);
try
{
copy = new Dictionary<T, T2>(dictionary);
}
finally { Monitor.Exit(dictionary); }
return copy;
}
maybe you can use the lock statement to but either way it works but you have to lock the dictionaries while reading/modifying to reach the thread safe point and to avoid such errors

and remember try to keep the lock blocks as small as possible, but make sure they are always locking around the shared resources correctly.

Good Luck .
{ Angelius } is offline  
Thanks
2 Users
Old 05/14/2011, 04:03   #4
 
marlyandedsel's Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 343
Received Thanks: 21
Quote:
Originally Posted by { Angelius } View Post
some extra info on what 12tails just said ,
The problem is that, if you are doing a foreach loop over a collection, and another thread modifies the collection, the enumerator used in foreach is no longer valid. This will cause an exception to throw at that point.

on how to fix it.

you can do something like this .


maybe you can use the lock statement to but either way it works but you have to lock the dictionaries while reading/modifying to reach the thread safe point and to avoid such errors

and remember try to keep the lock blocks as small as possible, but make sure they are always locking around the shared resources correctly.

Good Luck .


Here is the code i found in that error.....

foreach (Game.Entity monster in Owner.Map.Entities.Values)
{
if (Kernel.GetDistance(monster.X, monster.Y, Owner.Entity.X,
Owner.Entity.Y) <= Constants.nScreenDistance &&
!Contains(monster.UID))
{
if (!monster.Dead)
{
monster.SendSpawn(Owner);
}
}
}


hmmm.. what things to do. yes I get some ideas but, Im sorry for that I just really want to learn on how to do this....
marlyandedsel is offline  
Old 05/14/2011, 04:09   #5
 
{ Angelius }'s Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
Quote:
Originally Posted by marlyandedsel View Post
Here is the code i found in that error.....

foreach (Game.Entity monster in Owner.Map.Entities.Values)
{
if (Kernel.GetDistance(monster.X, monster.Y, Owner.Entity.X,
Owner.Entity.Y) <= Constants.nScreenDistance &&
!Contains(monster.UID))
{
if (!monster.Dead)
{
monster.SendSpawn(Owner);
}
}
}


hmmm.. what things to do. yes I get some ideas but, Im sorry for that I just really want to learn on how to do this....

create a static class and call it Dictionary and copy paste the thread safe dictionary void that i provided in the earlier replay to it ,

so it looks like this

Quote:
static class Dictionary
{
static public Dictionary<T, T2> ThreadSafeDictionary<T, T2>(this Dictionary<T, T2> dictionary)
{
Dictionary<T, T2> copy;
Monitor.Enter(dictionary);
try
{
copy = new Dictionary<T, T2>(dictionary);
}
finally { Monitor.Exit(dictionary); }
return copy;
}
}
and change the void to look like this ,

Quote:
foreach (Game.Entity monster in Dictionary.ThreadSafeDictionary(Owner.Map.Entities ).Values)
{
if (Kernel.GetDistance(monster.X, monster.Y, Owner.Entity.X,
Owner.Entity.Y) <= Constants.nScreenDistance &&
!Contains(monster.UID))
{
if (!monster.Dead)
{
monster.SendSpawn(Owner);
}
}
}
and you'll never get that error again

a small edit for more information about it :

the code snip that i provided up there should lock the original dictionary which is (Owner.Map.Entities) to make sure its protected while copying it creates a new empty dictionary copies the original dictionary(Owner.Map.Entities)key's/value's to the new dictionary and returns the created copy not the original dictionary ,

so when you do the for each you are doing it using the copy not the original which mean if somehow you modify the original dictionary while doing a for each you are not gonna get that error and the original dictionary should be secured all the time by locking it every time you try to read it/modify it .

Good luck
{ Angelius } is offline  
Thanks
1 User
Old 05/14/2011, 06:08   #6
 
marlyandedsel's Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 343
Received Thanks: 21
Quote:
Originally Posted by { Angelius } View Post
create a static class and call it Dictionary and copy paste the thread safe dictionary void that i provided in the earlier replay to it ,

so it looks like this


and change the void to look like this ,



and you'll never get that error again

a small edit for more information about it :

the code snip that i provided up there should lock the original dictionary which is (Owner.Map.Entities) to make sure its protected while copying it creates a new empty dictionary copies the original dictionary(Owner.Map.Entities)key's/value's to the new dictionary and returns the created copy not the original dictionary ,

so when you do the for each you are doing it using the copy not the original which mean if somehow you modify the original dictionary while doing a for each you are not gonna get that error and the original dictionary should be secured all the time by locking it every time you try to read it/modify it .

Good luck

I just add like this
Quote:
namespace Conquer_Online_Server.Game
{
//

static class Dictionary
{
static public Dictionary<T, T2> ThreadSafeDictionary<T, T2>(this Dictionary<T, T2> dictionary)
{
Dictionary<T, T2> copy;
Monitor.Enter(dictionary);
try
{
copy = new Dictionary<T, T2>(dictionary);
}
finally { Monitor.Exit(dictionary); }
return copy;
}
}
//
and i just add the code you give and delete the older one like this

Quote:
/* foreach (Game.Entity monster in Owner.Map.Entities.Values)
{
if (Kernel.GetDistance(monster.X, monster.Y, Owner.Entity.X, Owner.Entity.Y) <= Constants.nScreenDistance && !Contains(monster.UID))
{
if (!monster.Dead)
{
monster.SendSpawn(Owner);
}
}
} */
//

foreach (Game.Entity monster in Dictionary.ThreadSafeDictionary(Owner.Map.Entities ).Values)
{
if (Kernel.GetDistance(monster.X, monster.Y, Owner.Entity.X,
Owner.Entity.Y) <= Constants.nScreenDistance &&
!Contains(monster.UID))
{
if (!monster.Dead)
{
monster.SendSpawn(Owner);
}
}
}
//

it working fine... is it correct .... thanks mate your just a nice person here...
marlyandedsel is offline  
Reply


Similar Threads Similar Threads
Comands for 12talis source (5369)
08/14/2012 - CO2 PServer Guides & Releases - 28 Replies
Here all commands How use? Go to source>Instances>Chat>Commands.cs And read!!!!!!:mad:
[Guide] How set up 12talis 5369 source
01/10/2012 - CO2 PServer Guides & Releases - 120 Replies
Read his one most important part of his guide http://www.elitepvpers.com/forum/co2-pserver-disc ussions-questions/177002-ask-yourself-before-you-s tart-trying-make-server.html First download source http://www.elitepvpers.com/forum/co2-pserver-guide s-releases/1174175-release-virtual-legends-source- 5369-a.html Second get client http://www.megaupload.com/?d=VZNKMSV0
Help me source 5369!
05/13/2011 - CO2 Private Server - 5 Replies
In the configuration there is no where to put the name of the database or login and password for app serv help plz:o sorry my bad english
i wanna Auth Server source 5369 Please
05/12/2011 - CO2 Private Server - 3 Replies
i wanna Auth Server source 5369 Please Fast Please All I Need It
[Release] Virtual Legends Source (5369)
05/12/2011 - CO2 PServer Guides & Releases - 162 Replies
Yo... READ THIS >>> The source is unfinished and requires C# KNOWLEGE <<< since this is going to happen soon or later, i'm going to release this source //CREDITS: -impulse- > Source base released version 5165 -Shunsui- (Jose) > a friend who coded this source with me 12tails (me/Leo) > for coding and release Spirited / Fang > For give to us his character on real co to sniff packets hahahahaha



All times are GMT +1. The time now is 15:50.


Powered by vBulletin®
Copyright ©2000 - 2026, 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 ©2026 elitepvpers All Rights Reserved.