Jump to content

Problem exiting the game in most files


Draveniou1

Recommended Posts

  • Active Member

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 by Draveniou1
update fix problem exit from client
  • Metin2 Dev 2
  • Lmao 2
  • Love 1
Link to comment
Share on other sites

  • Contributor

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 by TMP4
  • Good 2
Link to comment
Share on other sites

  • Active Member
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

  • Contributor
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 🤣

apNQn79_460s.jpg

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 by Metin2 Dev
Core X - External 2 Internal
  • Lmao 3
Link to comment
Share on other sites

  • Active Member
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 🤣

apNQn79_460s.jpg

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 by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Contributor
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

  • Active Member
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;

 

  • Lmao 1
Link to comment
Share on other sites

  • Honorable Member

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 by martysama0134
  • Metin2 Dev 2
  • Good 3
  • Love 2
Link to comment
Share on other sites

  • Active Member
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;

 

  • Sad 1
Link to comment
Share on other sites

  • Honorable Member
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...

  • Sad 1
  • Lmao 12
  • Good 1
  • Love 1

 

Link to comment
Share on other sites

  • Active Member
6 minutes ago, WeedHex said:

pointer GIF

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 by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Developer
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;

 

29b27ae93247fb3adebea19dc77ea962.gif

Edited by Metin2 Dev
Core X - External 2 Internal
  • Lmao 10

when you return 0 and server doesn't boot:

unknown.png

Link to comment
Share on other sites

  • Active Member
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 🥴

305316npe.png

Edited by Helia01
Link to comment
Share on other sites

  • Active Member
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

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

  • Active Member
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 by Helia01
  • Love 1
Link to comment
Share on other sites

  • Active Member
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

  • Active Member

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;

 

  • Lmao 3
Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.