if (Game.World.H_Chars.Contains(GC.MyChar.EntityID))
{
Game.Character Old = (Game.Character)Game.World.H_Chars[GC.MyChar.EntityID];
Old.MyClient.Disconnect(true);
if (!Game.World.H_Chars.Contains(GC.MyChar.EntityID))
Game.World.H_Chars.Add(GC.MyChar.EntityID, GC.MyChar);
GC.MyChar = Database.LoadCharacter(GC.AuthInfo.Character, ref Acc);
GC.MyChar.MyClient = GC;
GC.AddSend(Packets.SystemMessage(GC.MessageID, "ANSWER_OK"));
GC.AddSend(Packets.CharacterInfo(GC.MyChar));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.VIPLevel, GC.MyChar.VipLevel));
GC.AddSend(Packets.Time());
GC.AddSend(Packets.Donators(GC.MyChar));
GC.AddSend(Packets.Packet1012(GC.MyChar.EntityID));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.Effect, 0));
}
else
{
Game.World.H_Chars.Add(GC.MyChar.EntityID, GC.MyChar);
GC.AddSend(Packets.SystemMessage(GC.MessageID, "ANSWER_OK"));
GC.AddSend(Packets.CharacterInfo(GC.MyChar));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.VIPLevel, GC.MyChar.VipLevel));
GC.AddSend(Packets.Time());
GC.AddSend(Packets.Donators(GC.MyChar));
GC.AddSend(Packets.Packet1012(GC.MyChar.EntityID));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.Effect, 0));
}
if (Game.World.H_Chars.ContainsKey(GC.MyChar.EntityID))
{
Game.Character Old = (Game.Character)Game.World.H_Chars[GC.MyChar.EntityID];
Old.MyClient.Disconnect();
if (Game.World.H_Chars.ContainsKey(GC.MyChar.EntityID))
Game.World.H_Chars.Remove(GC.MyChar.EntityID);
GC.MyChar = Database.LoadCharacter(GC.AuthInfo.Character, ref Acc);
GC.MyChar.MyClient = GC;
Game.World.H_Chars.Add(GC.MyChar.EntityID, GC.MyChar);
GC.AddSend(Packets.SystemMessage(GC.MessageID, "ANSWER_OK"));
GC.AddSend(Packets.CharacterInfo(GC.MyChar));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.VIPLevel, GC.MyChar.VipLevel));
GC.AddSend(Packets.Time());
GC.AddSend(Packets.Donators(GC.MyChar));
GC.AddSend(Packets.Packet1012(GC.MyChar.EntityID));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.Effect, 0));
}
else
{
Game.World.H_Chars.Add(GC.MyChar.EntityID, GC.MyChar);
GC.AddSend(Packets.SystemMessage(GC.MessageID, "ANSWER_OK"));
GC.AddSend(Packets.CharacterInfo(GC.MyChar));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.VIPLevel, GC.MyChar.VipLevel));
GC.AddSend(Packets.Time());
GC.AddSend(Packets.Donators(GC.MyChar));
GC.AddSend(Packets.Packet1012(GC.MyChar.EntityID));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.Effect, 0));
}
Lol?Quote:
try this one ...
Code:if (Game.World.H_Chars.Contains(GC.MyChar.EntityID)) { Game.Character Old = (Game.Character)Game.World.H_Chars[GC.MyChar.EntityID]; Old.MyClient.Disconnect(true); if (!Game.World.H_Chars.Contains(GC.MyChar.EntityID)) Game.World.H_Chars.Add(GC.MyChar.EntityID, GC.MyChar); GC.MyChar = Database.LoadCharacter(GC.AuthInfo.Character, ref Acc); GC.MyChar.MyClient = GC; GC.AddSend(Packets.SystemMessage(GC.MessageID, "ANSWER_OK")); GC.AddSend(Packets.CharacterInfo(GC.MyChar)); GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.VIPLevel, GC.MyChar.VipLevel)); GC.AddSend(Packets.Time()); GC.AddSend(Packets.Donators(GC.MyChar)); GC.AddSend(Packets.Packet1012(GC.MyChar.EntityID)); GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.Effect, 0)); } else { Game.World.H_Chars.Add(GC.MyChar.EntityID, GC.MyChar); GC.AddSend(Packets.SystemMessage(GC.MessageID, "ANSWER_OK")); GC.AddSend(Packets.CharacterInfo(GC.MyChar)); GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.VIPLevel, GC.MyChar.VipLevel)); GC.AddSend(Packets.Time()); GC.AddSend(Packets.Donators(GC.MyChar)); GC.AddSend(Packets.Packet1012(GC.MyChar.EntityID)); GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.Effect, 0)); }
LOL. It works perfectly fine for me because I have switched to MySQL.Quote:
Both of you are wrong.
You still get the same error.
Hold on, I'll look into it too.
#EDIT: There's a problem with the original code, but not as you described it.
The Problem:
The server sees that once the 2nd client tries to connect that both the 1st and 2nd Client disconnect; however, the 2nd Client is still logged on. As a result, the server starts not saving the character. That's the error that we're facing.
[Only registered and activated users can see links. Click Here To Register...]
The first login is normal- the 1st Client.
The disconnect is normal- the 1st Client Disconnecting for the 2nd Client.
The 2nd Login is normal - the 2nd Client Logging in.
The 2nd disconnect is the problem.
Get it? =\
FYI, that was not my code... it came from the original one.. i only added some code which i believe are missing. I haven't tried it... if it wont work...then dont use it! SimplE!Quote:
Okay, made some tests and this is the perfect script. Works nice.PHP Code:if (Game.World.H_Chars.ContainsKey(GC.MyChar.EntityID))
{
Game.Character Old = (Game.Character)Game.World.H_Chars[GC.MyChar.EntityID];
Old.MyClient.Disconnect();
if (Game.World.H_Chars.ContainsKey(GC.MyChar.EntityID))
Game.World.H_Chars.Remove(GC.MyChar.EntityID);
GC.MyChar = Database.LoadCharacter(GC.AuthInfo.Character, ref Acc);
GC.MyChar.MyClient = GC;
Game.World.H_Chars.Add(GC.MyChar.EntityID, GC.MyChar);
GC.AddSend(Packets.SystemMessage(GC.MessageID, "ANSWER_OK"));
GC.AddSend(Packets.CharacterInfo(GC.MyChar));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.VIPLevel, GC.MyChar.VipLevel));
GC.AddSend(Packets.Time());
GC.AddSend(Packets.Donators(GC.MyChar));
GC.AddSend(Packets.Packet1012(GC.MyChar.EntityID));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.Effect, 0));
}
else
{
Game.World.H_Chars.Add(GC.MyChar.EntityID, GC.MyChar);
GC.AddSend(Packets.SystemMessage(GC.MessageID, "ANSWER_OK"));
GC.AddSend(Packets.CharacterInfo(GC.MyChar));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.VIPLevel, GC.MyChar.VipLevel));
GC.AddSend(Packets.Time());
GC.AddSend(Packets.Donators(GC.MyChar));
GC.AddSend(Packets.Packet1012(GC.MyChar.EntityID));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.Effect, 0));
}
Lol?
Copy machine.
Ah my bad actually no, you are not a copy machine... You was close...though.
Using your code you can't be seen by others.
if (Game.World.H_Chars.Contains(GC.MyChar.EntityID))
{
Game.Character Old = (Game.Character)Game.World.H_Chars[GC.MyChar.EntityID];
Old.MyClient.Disconnect();
[COLOR="Blue"] Game.World.H_Chars.Remove(Old.EntityID);[/COLOR]
if (!Game.World.H_Chars.Contains(GC.MyChar.EntityID))
Game.World.H_Chars.Add(GC.MyChar.EntityID, GC.MyChar);
GC.MyChar = Database.LoadCharacter(GC.AuthInfo.Character, ref Acc);
GC.MyChar.MyClient = GC;
GC.AddSend(Packets.SystemMessage(GC.MessageID, "ANSWER_OK"));
GC.AddSend(Packets.CharacterInfo(GC.MyChar));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.VIPLevel, GC.MyChar.VipLevel));
GC.AddSend(Packets.Time());
GC.AddSend(Packets.Donators(GC.MyChar));
GC.AddSend(Packets.Packet1012(GC.MyChar.EntityID));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.Effect, 0));
}
else
{
[COLOR="#ff0000"]Game.World.H_Chars.Add(GC.MyChar.EntityID, GC.MyChar);[/COLOR]
GC.AddSend(Packets.SystemMessage(GC.MessageID, "ANSWER_OK"));
GC.AddSend(Packets.CharacterInfo(GC.MyChar));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.VIPLevel, GC.MyChar.VipLevel));
GC.AddSend(Packets.Time());
GC.AddSend(Packets.Donators(GC.MyChar));
GC.AddSend(Packets.Packet1012(GC.MyChar.EntityID));
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.Effect, 0));
}