Register for your free account! | Forgot your password?

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

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

Advertisement



Characters Stuck Online

Discussion on Characters Stuck Online within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2007
Posts: 340
Received Thanks: 38
Characters Stuck Online

Hey guys...I got a problem with characters getting stuck in-game (even though the players are not in-game)...I tried changing the disconnect void, the logoff void...to check every minute if there's a client not connected but still added to a client hashtable to be logged off but still nothing...
here are my voids...

LogOff
Code:
public void LogOff()
        {
            try
            {
                Game.Buff B = MyChar.BuffOf(NewestCOServer.Features.SkillsClass.ExtraEffect.Transform);
                MyChar.RemoveBuff(B);
                if (MyChar.MyCompanion != null)
                    MyChar.MyCompanion.Dissappear();
                if (MyChar.MyTeam != null)
                {
                    if (MyChar.TeamLeader)
                        MyChar.MyTeam.Dismiss(MyChar);
                    else
                        MyChar.MyTeam.Leaves(MyChar);
                }
                if (MyChar.Loc.Map == 1039 || MyChar.Loc.Map == 1036 || MyChar.Loc.Map == 2021 || MyChar.Loc.Map == 2022 || MyChar.Loc.Map == 2023 || MyChar.Loc.Map == 2024 || MyChar.Loc.Map == 1051)
                {
                    Game.Vector2 V = (Game.Vector2)Database.DefaultCoords[MyChar.Loc.PreviousMap];
                    MyChar.Teleport(MyChar.Loc.PreviousMap, V.X, V.Y);
                }
                if (MyChar.MyShop != null)
                    MyChar.MyShop.Close();
                foreach (Game.Friend F in MyChar.Friends.Values)
                {
                    AddSend(Packets.FriendEnemyPacket(F.UID, F.Name, 15, Convert.ToByte(F.Online)));
                    if (F.Online)
                    {
                        F.Info.MyClient.AddSend(Packets.FriendEnemyPacket(MyChar.EntityID, MyChar.Name, 14, 1));
                        F.Info.MyClient.AddSend(Packets.FriendEnemyPacket(MyChar.EntityID, MyChar.Name, 15, 0));
                        F.Info.MyClient.LocalMessage(2005, "Your friend " + MyChar.Name + " has logged off.");
                    }
                }
                if (!MyChar.Alive)
                {
                    if (MyChar.Loc.Map == 1038 && Features.GuildWars.War)
                    {
                        MyChar.Loc.PreviousMap = MyChar.Loc.Map;
                        MyChar.Loc.Map = 6001;
                        MyChar.Loc.X = 32;
                        MyChar.Loc.Y = 72;
                    }
                    else
                    {
                        foreach (ushort[] Point in Database.RevPoints)
                            if (Point[0] == MyChar.Loc.Map)
                            {
                                MyChar.Loc.PreviousMap = MyChar.Loc.Map;
                                MyChar.Loc.Map = Point[1];
                                MyChar.Loc.X = Point[2];
                                MyChar.Loc.Y = Point[3];
                                break;
                            }

                    }
                    MyChar.CurHP = 1;
                }
            }
            catch { }
            if (Game.World.H_Chars.Contains(MyChar.EntityID) || Game.World.H_Clients.Contains(MyChar.EntityID))
            {
                Program.WriteLine("User " + MyChar.Name + " disconnected.");
                //here starts the part to tell me some infos about the character
                string Profs = "";
                string Skills = "";
                foreach (Game.Skill S in MyChar.Skills.Values)
                    Skills += S.ID + "~" + S.Lvl + "~" + S.Exp + "  ";
                if (Skills != "")
                    Program.WriteLine(MyChar.Name + " had Skills: " + Skills);
                foreach (Game.Prof P in MyChar.Profs.Values)
                    Profs += P.ID + "~" + P.Lvl + "~" + P.Exp + "  ";
                if (Profs != "")
                    Program.WriteLine(MyChar.Name + " had Profs: " + Profs);
                if (MyChar.DoubleExpLeft > 0)
                    Program.WriteLine(MyChar.Name + " had DoubleExp: " + MyChar.DoubleExpLeft);
                if (MyChar.VipLevel != 0)
                    Program.WriteLine(MyChar.Name + " had VIPLevel: " + MyChar.VipLevel + " days: " + MyChar.VIPDays);
                if (MyChar.VP > 0)
                    Program.WriteLine(MyChar.Name + " had " + MyChar.VP + " VPS.");
                if (MyChar.Reborns > 0)
                {
                    Program.WriteLine(MyChar.Name + " was class " + MyChar.PreviousJob1 + " before reborning.");
                    if (MyChar.PreviousJob2 != 0)
                        Program.WriteLine(MyChar.Name + " was class " + MyChar.PreviousJob2 + " before reborning second time.");
                }
                string Items = "";
                foreach (Game.Item I in MyChar.Inventory)
                    Items += I.ID + "~" + I.Plus + "~" + I.Bless + "~" + I.Enchant + "~" + I.Soc1 + "~" + I.Soc2 + "~" + I.Progress + "  ";
                Program.WriteLine(MyChar.Name + " had items in Inventory: " + Items);
                Items = "MA WH: ";
                foreach (Game.Item I in MyChar.Warehouses.MAWarehouse)
                    Items += I.ID + "~" + I.Plus + "~" + I.Bless + "~" + I.Enchant + "~" + I.Soc1 + "~" + I.Soc2 + "~" + I.Progress + "  ";
                Program.WriteLine(MyChar.Name + " had " + Items);
                Items = "TC WH: ";
                foreach (Game.Item I in MyChar.Warehouses.TCWarehouse)
                    Items += I.ID + "~" + I.Plus + "~" + I.Bless + "~" + I.Enchant + "~" + I.Soc1 + "~" + I.Soc2 + "~" + I.Progress + "  ";
                Program.WriteLine(MyChar.Name + " had " + Items);
                Items = "PC WH: ";
                foreach (Game.Item I in MyChar.Warehouses.PCWarehouse)
                    Items += I.ID + "~" + I.Plus + "~" + I.Bless + "~" + I.Enchant + "~" + I.Soc1 + "~" + I.Soc2 + "~" + I.Progress + "  ";
                Program.WriteLine(MyChar.Name + " had " + Items);
                Items = "AC WH: ";
                foreach (Game.Item I in MyChar.Warehouses.ACWarehouse)
                    Items += I.ID + "~" + I.Plus + "~" + I.Bless + "~" + I.Enchant + "~" + I.Soc1 + "~" + I.Soc2 + "~" + I.Progress + "  ";
                Program.WriteLine(MyChar.Name + " had " + Items);
                Items = "DC WH: ";
                foreach (Game.Item I in MyChar.Warehouses.DCWarehouse)
                    Items += I.ID + "~" + I.Plus + "~" + I.Bless + "~" + I.Enchant + "~" + I.Soc1 + "~" + I.Soc2 + "~" + I.Progress + "  ";
                Program.WriteLine(MyChar.Name + " had " + Items);
                Items = "BI WH: ";
                foreach (Game.Item I in MyChar.Warehouses.BIWarehouse)
                    Items += I.ID + "~" + I.Plus + "~" + I.Bless + "~" + I.Enchant + "~" + I.Soc1 + "~" + I.Soc2 + "~" + I.Progress + "  ";
                Program.WriteLine(MyChar.Name + " was level: " + MyChar.Level + " PC: " + (MyChar.Experience * 100) / Database.LevelExp[MyChar.Level]);
                Program.WriteLine(MyChar.Name + " had job: " + MyChar.Job);
                Program.WriteLine(MyChar.Name + " had silvers: " + MyChar.Silvers);
                Program.WriteLine(MyChar.Name + " had WH silvers: " + MyChar.WHSilvers);
                Program.WriteLine(MyChar.Name + " had WH: " + Items);
                Program.WriteLine(MyChar.Name + " had top gear: " + MyChar.Equips.HeadGear.ID + "~" + MyChar.Equips.HeadGear.Plus + "~" + MyChar.Equips.HeadGear.Bless + "~" + MyChar.Equips.HeadGear.Enchant + "~" + MyChar.Equips.HeadGear.Soc1 + "~" + MyChar.Equips.HeadGear.Soc2 + "~" + MyChar.Equips.HeadGear.Progress);
                Program.WriteLine(MyChar.Name + " had necklace: " + MyChar.Equips.Necklace.ID + "~" + MyChar.Equips.Necklace.Plus + "~" + MyChar.Equips.Necklace.Bless + "~" + MyChar.Equips.Necklace.Enchant + "~" + MyChar.Equips.Necklace.Soc1 + "~" + MyChar.Equips.Necklace.Soc2 + "~" + MyChar.Equips.Necklace.Progress);
                Program.WriteLine(MyChar.Name + " had ring: " + MyChar.Equips.Ring.ID + "~" + MyChar.Equips.Ring.Plus + "~" + MyChar.Equips.Ring.Bless + "~" + MyChar.Equips.Ring.Enchant + "~" + MyChar.Equips.Ring.Soc1 + "~" + MyChar.Equips.Ring.Soc2 + "~" + MyChar.Equips.Ring.Progress);
                Program.WriteLine(MyChar.Name + " had right hand: " + MyChar.Equips.RightHand.ID + "~" + MyChar.Equips.RightHand.Plus + "~" + MyChar.Equips.RightHand.Bless + "~" + MyChar.Equips.RightHand.Enchant + "~" + MyChar.Equips.RightHand.Soc1 + "~" + MyChar.Equips.RightHand.Soc2 + "~" + MyChar.Equips.RightHand.Progress);
                Program.WriteLine(MyChar.Name + " had left hand: " + MyChar.Equips.LeftHand.ID + "~" + MyChar.Equips.LeftHand.Plus + "~" + MyChar.Equips.LeftHand.Bless + "~" + MyChar.Equips.LeftHand.Enchant + "~" + MyChar.Equips.LeftHand.Soc1 + "~" + MyChar.Equips.LeftHand.Soc2 + "~" + MyChar.Equips.LeftHand.Progress);
                Program.WriteLine(MyChar.Name + " had armor: " + MyChar.Equips.Armor.ID + "~" + MyChar.Equips.Armor.Plus + "~" + MyChar.Equips.Armor.Bless + "~" + MyChar.Equips.Armor.Enchant + "~" + MyChar.Equips.Armor.Soc1 + "~" + MyChar.Equips.Armor.Soc2 + "~" + MyChar.Equips.Armor.Progress);
                Program.WriteLine(MyChar.Name + " had boots: " + MyChar.Equips.Boots.ID + "~" + MyChar.Equips.Boots.Plus + "~" + MyChar.Equips.Boots.Bless + "~" + MyChar.Equips.Boots.Enchant + "~" + MyChar.Equips.Boots.Soc1 + "~" + MyChar.Equips.Boots.Soc2 + "~" + MyChar.Equips.Boots.Progress);
                //and here ends the info part
                if (MyChar.MyGuild != null)
                    MyChar.MyGuild.GuildMsg("SYSTEM", MyChar.MyGuild.Members.Values.ToString(), MyChar.Name + " has logged off.", 0);
                Database.SaveCharacter(MyChar, AuthInfo.Account);
                    Game.World.H_Chars.Remove(MyChar.EntityID);
                    Game.World.H_Clients.Remove(MyChar.EntityID);
                if (Game.World.H_CharsDrawing.Contains(MyChar.EntityID))
                    Game.World.H_CharsDrawing.Remove(MyChar.EntityID);
                Game.World.Action(MyChar, Packets.GeneralData(MyChar.EntityID, 0, 0, 0, 135).Get);
                MyChar.MyClient = null;
            }
        }
Disconnect
Code:
        public void Disconnect()
        {
            try
            {
                if (Soc.Connected)
                {
                    Soc.Shutdown(SocketShutdown.Both);
                    LogOff();
                    Soc.Close();
                }
            }
            catch (Exception Exc) { Program.WriteLine(Exc); }
        }
And even more...there are no errors on the console...so IDK what's the problem...

the repeated check....(maybe it has to be removed idk....it was the same without this)
Code:
            try
            {
                foreach (Main.GameClient C in World.H_Clients.Values)
                    if ((!C.Soc.Connected || C.Soc == null || C == null) && !World.Exit)
                    {
                        C.LogOff();
                    }
            }
            catch { }
Any suggestions what could cause this character stuck in-game?
ryuchetval is offline  
Old 10/31/2010, 20:48   #2
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,225
Received Thanks: 868
Your problem is that your using Newestcoserver. Thank me later.
_DreadNought_ is offline  
Thanks
2 Users
Old 10/31/2010, 20:57   #3
 
elite*gold: 0
Join Date: Feb 2007
Posts: 340
Received Thanks: 38
so this occurs in all newestcoserver? o.O
ryuchetval is offline  
Old 10/31/2010, 23:32   #4
 
hunterman01's Avatar
 
elite*gold: 20
Join Date: Dec 2006
Posts: 945
Received Thanks: 175
Pretty much lol
hunterman01 is offline  
Old 10/31/2010, 23:46   #5
 
elite*gold: 0
Join Date: Sep 2008
Posts: 128
Received Thanks: 8
In Mine not... Anyway I'm gonna quit that **** soon (Also release it soon)
StefanHAKER is offline  
Old 11/01/2010, 01:15   #6
 
pwerty's Avatar
 
elite*gold: 0
Join Date: Jul 2010
Posts: 55
Received Thanks: 11
Edit : nvm =/
pwerty is offline  
Old 11/01/2010, 02:32   #7
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
Quote:
Originally Posted by StefanHAKER View Post
In Mine not... Anyway I'm gonna quit that **** soon (Also release it soon)
Maybe because nobody logs on.
copz1337 is offline  
Old 11/01/2010, 10:10   #8
 
elite*gold: 0
Join Date: Feb 2007
Posts: 340
Received Thanks: 38
well....I though of something not sure if it's right or wrong...
I have this in a thread that runs every 200 ms....
Code:
lock (World.H_Chars)
{
some codes....
}
does this prevent players from logging out correctly?
ryuchetval is offline  
Old 11/01/2010, 10:25   #9


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
No, the lock should delay any requesting threads untill the code within the lock has completed, it doesnt cancel and requests to the object, just delays them.

Basically what your doing is, your removing an object from an array while your navigating through the array, doing this will throw an exception, you have a try {} catch {} surrounding the piece of code however you dont tell it to catch exceptions, so it doesnt catch anything and just allows the code to continue.

What you need to do is loop through your list of clients and mark those needing to be logged of, put them in a temporary dictionary for example, then once you have got all the clients that need logging off, then log them off. This must be done outside of the foreach loop you have currently.
Korvacs is offline  
Old 11/01/2010, 17:09   #10
 
elite*gold: 0
Join Date: Feb 2007
Posts: 340
Received Thanks: 38
Quote:
Originally Posted by Korvacs View Post
No, the lock should delay any requesting threads untill the code within the lock has completed, it doesnt cancel and requests to the object, just delays them.

Basically what your doing is, your removing an object from an array while your navigating through the array, doing this will throw an exception, you have a try {} catch {} surrounding the piece of code however you dont tell it to catch exceptions, so it doesnt catch anything and just allows the code to continue.

What you need to do is loop through your list of clients and mark those needing to be logged of, put them in a temporary dictionary for example, then once you have got all the clients that need logging off, then log them off. This must be done outside of the foreach loop you have currently.
so you mean something like this?
Code:
                Hashtable TempClients = World.H_Clients;
                foreach (Main.GameClient C in TempClients)
                        if ((!C.Soc.Connected || C.Soc == null || C == null) && !World.Exit)
                        {
                            C.LogOff();
                        }
                TempClients = null;
or like this
Code:
                ArrayList Clients = new ArrayList();
                foreach (Main.GameClient C in World.H_Clients.Values)
                    Clients.Add(C);
                foreach (Main.GameClient C in Clients)
                        if ((!C.Soc.Connected || C.Soc == null || C == null) && !World.Exit)
                        {
                            C.LogOff();
                        }
                Clients = null;
or both work...
ryuchetval is offline  
Old 11/01/2010, 17:30   #11


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Both appear to be acceptable, give them a try, although out of the 2 i would suggest the first one.
Korvacs is offline  
Old 11/01/2010, 17:35   #12
 
elite*gold: 0
Join Date: Feb 2007
Posts: 340
Received Thanks: 38
k i'll try em thanks
ryuchetval is offline  
Old 11/01/2010, 18:50   #13
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,225
Received Thanks: 868
Heres an example of a try catch that will catch exceptions
Code:
try
{
      //code, ex: Every character spawn a npc next to and start sucking her/his ****
}
catch (exception e)
{
       Console.WriteLine("Exception caught! \n\n\n\t {0}", e);
}
_DreadNought_ is offline  
Reply


Similar Threads Similar Threads
Isya Online Offline? oder Online???
04/15/2011 - Private Server - 847 Replies
Hey ich wollte einfach eine eigende Dicusion(schreibfehler :D) für IsyaOnline haben :D Ich hoffe ihr nutzt es :bandit::bandit: MfG Fire PS: Viel spaß noch weiterhin ;)



All times are GMT +1. The time now is 17:13.


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