Active Member Draveniou1 723 Posted October 30, 2021 Active Member Share Posted October 30, 2021 (edited) I notice various files with problem when exiting the game, If you leave the game the character is online, client is going off but character is still in game We fixed the problem today and it works perfectly /* It is only for files that have this problem like mainline ++ files */ 1) Open cmt_general.cpp search: case SCMD_QUIT: ch->ChatPacket(CHAT_TYPE_COMMAND, "quit"); break; change with: case SCMD_QUIT: if (d) d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); break; Fix by @ martysama0134 case SCMD_QUIT: ch->ChatPacket(CHAT_TYPE_COMMAND, "quit"); if (d) d->DelayedDisconnect(1); break; ------------------------------------------------------------------------ for me good case SCMD_QUIT: ch->ChatPacket(CHAT_TYPE_COMMAND, "quit"); if (d) d->DelayedDisconnect(3); break; Edited October 30, 2021 by Draveniou1 update fix problem exit from client 2 2 1 Link to comment Share on other sites More sharing options...
Contributor TMP4 11115 Posted October 30, 2021 Contributor Share Posted October 30, 2021 (edited) First of all you can't call it a fix, since you did not fixed the root of the error, just doing the disconnect in another way. (Let's say I broke my phone, if I buy a new phone then I did not fix my old phone) Secondly the "d->ChatPacket(CHAT_TYPE_COMMAND, "quit");" is redundant and not even correct with that d. It would be d->GetCharacter()->ChatPacket... but since we have ch we can use ch-->ChatPacket as it was. But again, it's redundant so better to remove, especially you forgot the braces Edited October 30, 2021 by TMP4 2 Link to comment Share on other sites More sharing options...
Active Member hachiwari 138 Posted October 30, 2021 Active Member Share Posted October 30, 2021 Did you know that if without curly braces is working only for first command? 1 Link to comment Share on other sites More sharing options...
Active Member Draveniou1 723 Posted October 30, 2021 Author Active Member Share Posted October 30, 2021 16 minutes ago, TMP4 said: First of all you can't call it a fix, since you did not fixed the root of the error, just doing the disconnect in another way. (Let's say I broke my phone, if I buy a new phone then I did not fix my old phone) Secondly the "d->ChatPacket(CHAT_TYPE_COMMAND, "quit");" is redundant and not even correct with that d. It would be d->GetCharacter()->ChatPacket... but since we have ch we can use ch-->ChatPacket as it was. But again, it's redundant so better to remove, especially you forgot the braces It's a different fix that may temporarily help many people who have had this problem for many years........ It has also been tested with many online players and works perfectly without any problems Link to comment Share on other sites More sharing options...
Contributor TMP4 11115 Posted October 30, 2021 Contributor Share Posted October 30, 2021 (edited) 14 minutes ago, Draveniou1 said: It's a different fix that may temporarily help many people who have had this problem for many years........ It has also been tested with many online players and works perfectly without any problems The thing it works, and the thing it's right is a totally different story Please don't be mad At least remove the d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); because that is incorrect and redundant, and is outside of the if as hachiwari said. (If you really want to keep it, place if before the if and change back the d->ChatPacket to ch->ChatPacket) Edited August 26, 2022 by Metin2 Dev Core X - External 2 Internal 3 Link to comment Share on other sites More sharing options...
Active Member Draveniou1 723 Posted October 30, 2021 Author Active Member Share Posted October 30, 2021 (edited) 1 minute ago, TMP4 said: The thing it works, and the thing it's right is a totally different story Please don't be mad At least remove the d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); because that is incorrect and redundant, and is outside of the if as hachiwari said. if remove this d-> Then there will be other problems on the game.core server in some random situations. If you want to it but after that you will soon encounter problems with many players online with game.core It's better to stay that way ----> if (d) d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); Edited August 26, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Contributor TMP4 11115 Posted October 30, 2021 Contributor Share Posted October 30, 2021 1 minute ago, Draveniou1 said: if remove this d-> Then there will be other problems on the game.core server in some random situations. If you want to it but after that you will soon encounter problems with many players online with game.core It's better to stay that way ----> if (d) d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); You may misunderstood me: 1. correct version: case SCMD_QUIT: if (d) d->DelayedDisconnect(2); break; 2. correct but redundant version: case SCMD_QUIT: ch->ChatPacket(CHAT_TYPE_COMMAND, "quit"); if (d) d->DelayedDisconnect(2); break; Link to comment Share on other sites More sharing options...
Active Member Draveniou1 723 Posted October 30, 2021 Author Active Member Share Posted October 30, 2021 2 minutes ago, TMP4 said: You may misunderstood me: 1. correct version: case SCMD_QUIT: if (d) d->DelayedDisconnect(2); break; 2. correct but redundant version: case SCMD_QUIT: ch->ChatPacket(CHAT_TYPE_COMMAND, "quit"); if (d) d->DelayedDisconnect(2); break; Then the client will not close ....................................... /quit = client turn closed ---> we need this---> ch->ChatPacket(CHAT_TYPE_COMMAND, "quit"); Its 100% fix without game.core or another problems case SCMD_QUIT: if (d) d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); break; 1 Link to comment Share on other sites More sharing options...
Honorable Member martysama0134 7218 Posted October 30, 2021 Honorable Member Share Posted October 30, 2021 (edited) The problem is not related to "some serverfiles", but to the servers' network. In theory, after you close the client (via "quit" cmdchat) the connection should be interrupted, but on some occasions they remained stucked, and that's the bug. The stucked character will probably remain online for 300s until the server will kick it. case SCMD_QUIT: ch->ChatPacket(CHAT_TYPE_COMMAND, "quit"); if (d) d->SetPhase(PHASE_CLOSE); break; I would try like this first, otherwise I'll stick with DelayedDisconnect(1) instead of SetPhase like: case SCMD_QUIT: ch->ChatPacket(CHAT_TYPE_COMMAND, "quit"); if (d) d->DelayedDisconnect(1); break; 2 hours ago, Draveniou1 said: Its 100% fix without game.core or another problems case SCMD_QUIT: if (d) d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); break; You're missing if (d) { ... } brackets. if you were to get a nullptr d, you'd end up with a core crash there. Edited October 30, 2021 by martysama0134 2 3 2 Check out my GitHub Link to comment Share on other sites More sharing options...
Active Member Draveniou1 723 Posted October 30, 2021 Author Active Member Share Posted October 30, 2021 9 minutes ago, martysama0134 said: The problem is not related to "some serverfiles", but to the servers' network. In theory, after you close the client (via "quit" cmdchat) the connection should be interrupted, but on some occasions they remained stucked, and that's the bug. The stucked character will probably remain online for 300s until the server will kick it. case SCMD_QUIT: ch->ChatPacket(CHAT_TYPE_COMMAND, "quit"); if (d) d->SetPhase(PHASE_CLOSE); break; I would try like this first, otherwise I'll stick with DelayedDisconnect(1) instead of SetPhase You're missing if (d) { ... } brackets. if you were to get a nullptr d, you'd end up with a core crash there. You can also do this for greater security, although everything has been tested case SCMD_QUIT: if (d) { d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); } else { d->SetPhase(PHASE_CLOSE); // If the player tries to make a bug then the player will eat kick :) } break; 1 Link to comment Share on other sites More sharing options...
Honorable Member Mali 42587 Posted October 30, 2021 Honorable Member Share Posted October 30, 2021 8 minutes ago, Draveniou1 said: You can also do this for greater security, although everything has been tested case SCMD_QUIT: if (d) { d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); } else { d->SetPhase(PHASE_CLOSE); // If the player tries to make a bug then the player will eat kick :) } break; It's getting more and more interesting... 1 12 1 1 Link to comment Share on other sites More sharing options...
Premium WeedHex 636 Posted October 30, 2021 Premium Share Posted October 30, 2021 (edited) Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 2 Link to comment Share on other sites More sharing options...
Active Member Draveniou1 723 Posted October 30, 2021 Author Active Member Share Posted October 30, 2021 (edited) 6 minutes ago, WeedHex said: My friend, my own problem has been temporarily fixed and I am also trying to fix it 100% in a more correct way. This way is temporarily at least helped me It can also help many people as a temporary solution At least it works without game.core and problems Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Developer PACI 930 Posted October 30, 2021 Developer Share Posted October 30, 2021 (edited) 27 minutes ago, Draveniou1 said: case SCMD_QUIT: if (d) { d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); } else { d->SetPhase(PHASE_CLOSE); // If the player tries to make a bug then the player will eat kick :) } break; Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 10 when you return 0 and server doesn't boot: Link to comment Share on other sites More sharing options...
PetePeter 36 Posted October 30, 2021 Share Posted October 30, 2021 case SCMD_QUIT: if (d) d->SetPhase(PHASE_CLOSE); ch->ChatPacket(CHAT_TYPE_COMMAND, "quit"); break; What's wrong with simple things ? 1 Link to comment Share on other sites More sharing options...
Active Member Helia01 2163 Posted October 30, 2021 Active Member Share Posted October 30, 2021 (edited) 59 minutes ago, Draveniou1 said: You can also do this for greater security, although everything has been tested case SCMD_QUIT: if (d) { d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); } else { d->SetPhase(PHASE_CLOSE); // If the player tries to make a bug then the player will eat kick :) } break; EZ Crash core by NPE Edited October 30, 2021 by Helia01 Link to comment Share on other sites More sharing options...
Active Member Draveniou1 723 Posted October 30, 2021 Author Active Member Share Posted October 30, 2021 2 minutes ago, PetePeter said: case SCMD_QUIT: if (d) d->SetPhase(PHASE_CLOSE); ch->ChatPacket(CHAT_TYPE_COMMAND, "quit"); break; What's wrong with simple things ? 1) Download cheat engine 2) Try to stick the client in 1 second with the cheat engine and you will see that the server will output game.core solution and works perfectly case SCMD_QUIT: if (d) d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); break; or case SCMD_QUIT: if (d) { d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); } break; 1 minute ago, Helia01 said: EZ Crash core by NPE I have not worked hard enough this way but I work this way and it works perfectly case SCMD_QUIT: if (d) d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); break; or case SCMD_QUIT: if (d) { d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); } break; Link to comment Share on other sites More sharing options...
PetePeter 36 Posted October 30, 2021 Share Posted October 30, 2021 3 minutes ago, Draveniou1 said: 1) Download cheat engine 2) Try to stick the client in 1 second with the cheat engine and you will see that the server will output game.core solution and works perfectly case SCMD_QUIT: if (d) d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); break; or case SCMD_QUIT: if (d) { d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); } break; Did you understand than "d = ch->GetDesc()" ? Link to comment Share on other sites More sharing options...
Active Member Helia01 2163 Posted October 30, 2021 Active Member Share Posted October 30, 2021 (edited) 20 minutes ago, Draveniou1 said: 1) Download cheat engine 2) Try to stick the client in 1 second with the cheat engine and you will see that the server will output game.core solution and works perfectly case SCMD_QUIT: if (d) d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); break; or case SCMD_QUIT: if (d) { d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); } break; I have not worked hard enough this way but I work this way and it works perfectly case SCMD_QUIT: if (d) d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); break; or case SCMD_QUIT: if (d) { d->DelayedDisconnect(2); d->ChatPacket(CHAT_TYPE_COMMAND, "quit"); } break; Stop making questionable solutions. Your "solution" creates a core crash. The (posts above) showed you how to make this fix. We really appreciate that you have tried to fix this error. Please listen to more experienced guys. (If they say that your decision is dubious and not safe, then this is exactly the case). No offense Edited October 30, 2021 by Helia01 1 Link to comment Share on other sites More sharing options...
Active Member Draveniou1 723 Posted October 30, 2021 Author Active Member Share Posted October 30, 2021 8 minutes ago, Helia01 said: Stop making questionable solutions. Your "solution" creates a core crash. The (posts above) showed you how to make this fix. We really appreciate that you have tried to fix this error. Please listen to more experienced guys. (If they say that your decision is dubious and not safe, then this is exactly the case). No offense OK thanks . the issue is that we solved the problem from leaving the game I tried to make a better solution but as you can see we will use martysama the correction 2 hours ago, martysama0134 said: The problem is not related to "some serverfiles", but to the servers' network. In theory, after you close the client (via "quit" cmdchat) the connection should be interrupted, but on some occasions they remained stucked, and that's the bug. The stucked character will probably remain online for 300s until the server will kick it. case SCMD_QUIT: ch->ChatPacket(CHAT_TYPE_COMMAND, "quit"); if (d) d->SetPhase(PHASE_CLOSE); break; I would try like this first, otherwise I'll stick with DelayedDisconnect(1) instead of SetPhase like: case SCMD_QUIT: ch->ChatPacket(CHAT_TYPE_COMMAND, "quit"); if (d) d->DelayedDisconnect(1); break; You're missing if (d) { ... } brackets. if you were to get a nullptr d, you'd end up with a core crash there. @ martysama0134 thank you Good work for me this version : case SCMD_QUIT: ch->ChatPacket(CHAT_TYPE_COMMAND, "quit"); if (d) d->DelayedDisconnect(3); break; Link to comment Share on other sites More sharing options...
Developer Mitachi 1479 Posted October 30, 2021 Developer Share Posted October 30, 2021 (edited) There is an even simpler solution, just don't quit the game and replace metin2 with real life Edited August 15, 2022 by Metin2 Dev Core X - External 2 Internal 3 1 Link to comment Share on other sites More sharing options...
blanco 182 Posted October 30, 2021 Share Posted October 30, 2021 This might be the most intellectual topic on m2dev On a side note, this problem (along with many other side effects) is triggered every time you connect to the server with an IPv6 address. 2 Link to comment Share on other sites More sharing options...
Active Member Draveniou1 723 Posted October 30, 2021 Author Active Member Share Posted October 30, 2021 We have found the solution from martysama and it works perfectly on a server with 500-700 players online Our problem has been solved /* It is only for files that have this problem like mainline ++ files */ Perfect operation you can try @ Metin2 Dev Please lock the post thank you case SCMD_QUIT: ch->ChatPacket(CHAT_TYPE_COMMAND, "quit"); if (d) d->DelayedDisconnect(3); break; 3 Link to comment Share on other sites More sharing options...
Recommended Posts