Jump to content

Question

Posted (edited)

I wanted to ask a simple question.
Can you ( as Admin ) force a player to restart or relog WITHOUT closing his client?

I am talking about making him lose connection to the server or any kind of trick, unless there is a legit way to do it.

Thanks in advace.

Edited by L2J NexuS

11 answers to this question

Recommended Posts

  • 0
Posted

Yes, you can logout without closing the client. I guess there is some disconnect command, option. Otherwise, code command with player.logout(false) - stands for close client. Alt+g may have disconnect button, I don't remember. 

  • 0
Posted
1 hour ago, SweeTs said:

Yes, you can logout without closing the client. I guess there is some disconnect command, option. Otherwise, code command with player.logout(false) - stands for close client. Alt+g may have disconnect button, I don't remember. 

Well, there are 2 things i dont get.
First of all the logout function does not accept true or false.

Looks like this on L2PcInstance.
 

public void logout() {
		if (getInventory().getItemByItemId(9819) != null) {
			Fort fort = FortManager.getInstance().getFort(this);
			if (fort != null) {
				FortSiegeManager.getInstance().dropCombatFlag(this);
			} else {
				int slot = getInventory().getSlotFromItem(getInventory().getItemByItemId(9819));
				getInventory().unEquipItemInBodySlotAndRecord(slot);
				destroyItem("CombatFlag", getInventory().getItemByItemId(9819), null, true);
			}
		}

		closeNetConnection();
	}

I tried to just do this :

					activeChar.closeNetConnection();

But it closes the client as well. ( Which in my understanding is the same thing )
And it looks like this :

public void closeNetConnection() {
		L2GameClient client = _client;

		if (client != null) {
			if (client.isDetached()) {
				client.cleanMe(true);
			} else {
				if (!client.getConnection().isClosed()) {
					client.close(new LeaveWorld());
				}
			}
		}
	}

 

  • 0
Posted

No sources so can't check. But you could take a look at Shutdown.java and see the disconnect players code. Example of l2jserver. The try block of disconnectAllCharacters

 

https://bitbucket.org/l2jserver/l2j_server/src/2c43c001b69f644c9d96b85309f1757710bdbe14/src/main/java/com/l2jserver/gameserver/Shutdown.java?at=develop&fileviewer=file-view-default

  • 0
Posted
5 minutes ago, SweeTs said:

No sources so can't check. But you could take a look at Shutdown.java and see the disconnect players code. Example of l2jserver. The try block of disconnectAllCharacters

 

https://bitbucket.org/l2jserver/l2j_server/src/2c43c001b69f644c9d96b85309f1757710bdbe14/src/main/java/com/l2jserver/gameserver/Shutdown.java?at=develop&fileviewer=file-view-default

Thank you, ill check it out in an hour and tell you the result.

  • 0
Posted

No problem, but still, you should have the logout with boolean (there is logout() and logout(closeClient)) , check pcinstance, and search for it. Else they introduced it later. 

  • 0
Posted (edited)

As i can see there isn't anything related to logout(closeClient) or whatsoever.

 

Anyway i will look more into it, i will download some sources from H5 to see if there is something to help me in there.

 

Edit : disconnectingAllPlayers from Shutdown.java should do the job but i don't think i am so good with Java to understand what is going on in there, so i will teach my self something and then i will proceed on completing this.

Edited by L2J NexuS
  • 0
Posted

aCis way to disconnect from one or another way. Basically you only have to send the correct packet, LeaveWorld or ServerClose.

	private void closeNetConnection(boolean closeClient)
	{
		L2GameClient client = _client;
		if (client != null)
		{
			if (client.isDetached())
				client.cleanMe(true);
			else
			{
				if (!client.getConnection().isClosed())
				{
					if (closeClient)
						client.close(LeaveWorld.STATIC_PACKET);
					else
						client.close(ServerClose.STATIC_PACKET);
				}
			}
		}
	}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock