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);
				}
			}
		}
	}

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • You think you have good “l2j” files until you try running a low-rate server.   Saying “there’s not a single L2 server out there worth mentioning” just shows you probably only know the first 10 servers on voting sites, the same voting sites that owned by them. You call the forum dead, yet you’re here discussing your next projects… From my perspective, you don’t seem ready to run any L2 server in 2025. Around 70% of players are here for RMT or ask for payment just to bring their clan, and you really think the community cares about Premium or donations or files quality? The other 20% spend their time downloading and deleting servers all day, playing for one day, then quitting for whatever random reason. And finally, the last 10% are the only ones who actually play because they genuinely like your features, your server files, and your overall project. Good luck 🙂
    • I genuinely admire your bravery - in an age where AI can whip up something better in under a minute, you still stubbornly try to sell these "projects" of yours on a forum that’s been clinically dead for years. That’s no longer determination, that’s digital archaeology. I just can’t tell whether you’re actually trying to make money, or simply testing how much we can endure before we ask an AI to generate you some actual talent.   And ofc AI will make it for free, $220 saved.
    • I’m glad I’m not the only one who appreciates Maxthor’s involvement in group gay orgies, he can’t be bothered to reply to messages, but covering the entire forum in gay lights is absolutely no issue for him. As for the project - the forum is packed with feedback from the testers, the lads are spending every spare moment fixing even the tiniest typo in an NPC’s text. I’ll share the links as soon as I get the green light. Edit: I forgot to add that the GM recruitment will begin once the links are released. Three people will be accepted, and they’ll work in a three-shift rotation so that there’s always a GM available online.
    • Added: a brand-new default dashboard template. You can now add multiple game/login server builds. Full support for running both PTS & L2J servers simultaneously, with switching between them. Payment systems: added OmegaPay and Pally (new PayPal-style API). Account history now stores everything: donations, items delivered to characters, referrals, transfers between game accounts, and coin transfers to another master account. Personal Promo Code System: you can create a promo code and assign it to a user or promoter. When donating, a player can enter this promo code to receive bonus coins, and the promo code owner also receives a bonus — all fully configurable in the admin panel.     Look demo site: demo
    • One of best project i play last few years
  • Topics

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