Recently had a problem with this bug its kinda hard to explain so bear with me xD
lets say i have an character named Bob and i got 20 cps i log on and i trade my cps without logging out i load another client and login Bob again kicking me off One client and loading him on the new/other client causeing the account to not save and i still have my 20 cps even though i traded them.... <.< any ideas of how to fix it?
Recently had a problem with this bug its kinda hard to explain so bear with me xD
lets say i have an character named Bob and i got 20 cps i log on and i trade my cps without logging out i load another client and login Bob again kicking me off One client and loading him on the new/other client causeing the account to not save and i still have my 20 cps even though i traded them.... <.< any ideas of how to fix it?
When trading is a success, save the client in the DB?
Does the DCHandler have a call to save the character file on any sort of disconnect?
Also does the server check for more than one instance of the same account logged in?
Does the DCHandler have a call to save the character file on any sort of disconnect?
Also does the server check for more than one instance of the same account logged in?
I believe his server does, since it disconnects the already connected client...but the saving on a disconnect should be added (along with saving when a trade is completed), if it's not already.
Letter X how would you add that?
*edit- The saving on the disconnect that is
-removed
edit: I looked at the source (LOTF 5165), and from the Disconnect it goes to "LogOff" which the char is saved there. You should still save your char once trading is completed, for more protection. D;
edit2: Go to the Trade.cs; find "ent.MessageID, "SYSTEM", Who.Name, "Trading succeeded!", 2005, 0));". Under it add:
and then find "C.AddSend(Packets.ChatMessage(C.MessageID, "SYSTEM", C.MyChar.Name, "Trading succeeded!", 2005, 0));" (should be last line before the bracket), under it add:
OK fail there thought it worked but can still do it i got a better explanation though...
open first client....login Bob. open 2nd client and login...Phil to trade items/cps/anything to..open 3rd client and relog bob dcing him from the first client. trade the cps from bob to Phil. Close out of the 3rd client and login bob on the first client and still has the cps/items/ect ect
OK fail there thought it worked but can still do it i got a better explanation though...
open first client....login Bob. open 2nd client and login...Phil to trade items/cps/anything to..open 3rd client and relog bob dcing him from the first client. trade the cps from bob to Phil. Close out of the 3rd client and login bob on the first client and still has the cps/items/ect ect
Sounds to me like the server is still saving "bob" at the time that you log "bob" back in, so the server loads bob before it finshes saving.
Durring your login script, where it signals for "bob" to be disconnected, put a Thread.Sleep(10000) in and see if that helps, this will delay login for 10 seconds while the server performs a complete save.
edit: I looked at the source (LOTF 5165), and from the Disconnect it goes to "LogOff" which the char is saved there. You should still save your char once trading is completed, for more protection. D;
edit2: Go to the Trade.cs; find "ent.MessageID, "SYSTEM", Who.Name, "Trading succeeded!", 2005, 0));". Under it add:
and then find "C.AddSend(Packets.ChatMessage(C.MessageID, "SYSTEM", C.MyChar.Name, "Trading succeeded!", 2005, 0));" (should be last line before the bracket), under it add:
you are using many useless try catch blocks, this takes more time to process, just one on the whole block of sentences would do the same, and you might want to do some notification :}
void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
try
{
MyClient.EndSend();
if (!Program.EndSession)
if (MyClient != null)
Step();
if (Loaded)
if (DateTime.Now > LastSave.AddSeconds(8))
{
LastSave = DateTime.Now;
Database.SaveCharacter(this, MyClient.AuthInfo.Account);
}
}
catch(Exception ex) { Console.WriteLine(ex.Message); }
}
And about stopping people from login if the character is already online, check if the character id exists in the client pool, if it does, disconnect the socket of the client that is requesting to login
Update: just looked at the code you suggested, i don't think adding anything to that case will work, since the client is already logged on this case just informs your friends and enemies that you are online..
@ Nullable
That really didn't help. It's still on and off with the dupes, the same as it was when I switched the time that the server saves the character to the database. However that was a excellent job of optimizing that code. I wouldn't have thought of that myself. Thank you.
@ Nullable
That really didn't help. It's still on and off with the dupes, the same as it was when I switched the time that the server saves the character to the database. However that was a excellent job of optimizing that code. I wouldn't have thought of that myself. Thank you.
The most secure and most thorough fix for this problem would be to disable the ability to kick someone that is already logged in but logging in to the same account with a second client while the other person is logged in.
If this change was made the dupe problem would be no more.
Right now we're running a server with this dupe bug and there is over 150+ online
It's it's our highest priority to fix this **** thing.
Actually my comment about the OnElapsed event was never to fix that error.. just to make that code clearer, never said to minimize that error you're having or remove it, as i mentioned in my post, before accepting any client, before the actual client object gets created you should check in the client hashtable if they exist or not, if the same exact character exists in the online players, disconnect the client before his or her instance on the server gets created, thus the already online client will not disconnect, and the one who is trying to log on the connected client will always disconnect..
Thanks but i've got my cash already :P, feel free to ask anything(better send me a private message)
Well, as my method is not working properly, why don't you retrieve the old same code, and save the character manually, then disconnect it:
[Problem] Problem with server starting - cannot find quest index for PaxHeader 12/22/2009 - Metin2 Private Server - 1 Replies Hello!
I have this same problem as here when i'm starting my server:
http://www.elitepvpers.com/forum/metin2-pserver-di scussions-questions/307143-metin2-serverfiles-ques t-index-fehler.html
But I didn't know the answer.. how to repair this?
Greetings