Jump to content
For maintenance and updates, the community will be offline on 31 December 2022 ×
  • 0

Disable keyboard while warping


Minton

Question

Hi,

I'd like to disable the keyboard inputs when someone is warping since they bugging out stuff when goes into warp and then spams ESC. Because of that i want to disable every keyboard input instantly at teleport. How can i do that?

 

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 2
  • Nitro Booster
Posted (edited)

Just to answer the question of the topic, this is one way you can disable any key input while in the loading phase.

/*
* NOTE: This will only prevent inputting any key while in the loading phase.
* Be aware that you can still hit any key when selecting the character until it changes into the loading phase.
*/

/// 1. @ UserInterface/PythonNetworkStream.h
// Search
public:
	CPythonNetworkStream();

// Add above
	bool IsLoadingPhase() { return (m_strPhase == "Loading"); }

/// 2. @ UserInterface/PythonNetworkStream.h
// Search
	bool __DirectEnterMode_IsSet();

// Add below
public:
	bool DirectEnterMode_IsSet() { return __DirectEnterMode_IsSet(); }

/// 3. @ UserInterface/PythonApplicationEvent.cpp
// Search
void CPythonApplication::OnKeyDown(int iIndex)

// Add below (You might need to include "InstanceBase.h"
	CPythonNetworkStream& rkInstance = CPythonNetworkStream::Instance();
	if (rkInstance.DirectEnterMode_IsSet() || rkInstance.IsLoadingPhase())
		return;

 

Edited by Owsap
Added a better solution.
Link to comment
Share on other sites

  • 0
  • Distinguished Member
Posted (edited)

That's not how you solve such problems. That would be a weak workaround here, not a fix.

You have to fix your glitch's origin.
Have a look at this: 

Even if your problem is about another system like sash combination, battle pass or anything, the solution is the same: use CHARACTER :: CanWarp so players cannot warp when they are not allowed to.

Edited by TMP4
Link to comment
Share on other sites

  • 0
Posted (edited)
2 hours ago, TMP4 said:

That's not how you solve such problems. That would be a weak workaround here, not a fix.

You have to fix your glitch's origin.
Have a look at this: 

Even if your problem is about another system like sash combination, battle pass or anything, the solution is the same: use CHARACTER :: CanWarp so players cannot warp when they are not allowed to.

Hi,

Its already done for days now. I have added obviusly CanWarp to everything that is related, but mainly the warp gates that teleports instantly the main problem. (Yes, i have added the CanWarp to the gates too but then they do a logout->change channel->login->warp gate instantly->crash back into loginscreen (by spamming ESC)->relog to another channel )

Edited by Minton
Link to comment
Share on other sites

  • 0
  • Distinguished Member
1 minute ago, PACI said:

Remove the OnPressEscapeKey method from the introLoading module.

Then someone will come and just readd it to the clientside and continue the item duplication or whatever his players doing 😅

@ MintonTell us your exact problem what they are bugging out with which system. With your latest example it looks like it may not even related to the warp but the system itself.

Link to comment
Share on other sites

  • 0
1 minute ago, TMP4 said:

Then someone will come and just readd it to the clientside and continue the item duplication or whatever his players doing 😅

Replied to their question as they didn't want to elaborate further on their issue. At least this, for them, may buy some time until they figure what is wrong and share it with us.

when you return 0 and server doesn't boot:

unknown.png

Link to comment
Share on other sites

  • 0
3 minutes ago, PACI said:

Replied to their question as they didn't want to elaborate further on their issue. At least this, for them, may buy some time until they figure what is wrong and share it with us.

Its really hard to do the bug but there is still 1-2 player who can abuse it. I've contacted the developer of the system (since its not a  pirated system) he also sent some fixes but after that it became very hard but there is still a possibility to do it. I dont want to discuss neither the system or the exact steps to reproduce the bug because it can affect a some server that uses the given system. After the fix i'll post it of course. 

Link to comment
Share on other sites

  • 0
  • Premium
Posted (edited)

@ Owsap Good idea, but by this is impossible to detect the loading phase: 

CPythonNetworkStream& rkInstance = CPythonNetworkStream::Instance();
	if (rkInstance.IsLoadingPhase())
		return;

It works only with this:

if (!m_pyBackground.IsMapReady())
		return;

But with this, you cannot use the keys in character select.

Edited by ReFresh

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • 0
  • Nitro Booster
20 minutes ago, ReFresh said:

@ Owsap Good idea, but by this is impossible to detect the loading phase: 

CPythonNetworkStream& rkInstance = CPythonNetworkStream::Instance();
	if (rkInstance.IsLoadingPhase())
		return;

It works only with this:

if (!m_pyBackground.IsMapReady())
		return;

But with this, you cannot use the keys in character select.

Fixed, can you please test it again?

Link to comment
Share on other sites

  • 0
  • Premium
Posted (edited)

@ Owsap Great, it seems to be working like a charm now. Thank you.

Spoiler

Btw. Little tutorial correction, this function is by default in private class:

3 hours ago, Owsap said:
/// 2. @ UserInterface/PythonNetworkStream.h
// Search
public:
	bool __DirectEnterMode_IsSet();

So it should be like this in the tutorial:

/// 2. @ UserInterface/PythonNetworkStream.h
// Search
private:
	bool __DirectEnterMode_IsSet();

And this:

3 hours ago, Owsap said:
/// 1. @ UserInterface/PythonNetworkStream.h
// Search
public:
	CPythonNetworkStream();

// Add above
	bool IsLoadingPhase() { return (m_strPhase == "Loading"); }

Should be like this in the tutorial:

/// 1. @ UserInterface/PythonNetworkStream.h
// Search
	void StartGame();

// Add below
	bool IsLoadingPhase() { return (m_strPhase == "Loading"); }

 

Edited by ReFresh

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • 0
  • Nitro Booster
Posted (edited)
58 minutes ago, ReFresh said:

@ Owsap Great, it seems to be working like charm now. Thank you.

  Hide contents

Btw. Little tutorial correction, this function is by default in private class:

So it should be like this in the tutorial:

/// 2. @ UserInterface/PythonNetworkStream.h
// Search
private:
	bool __DirectEnterMode_IsSet();

And this:

Should be like this in the tutorial:

/// 1. @ UserInterface/PythonNetworkStream.h
// Search
	void StartGame();

// Add below
	bool IsLoadingPhase() { return (m_strPhase == "Loading"); }

 

Thanks for testing the solution I provided but what you citated about my tutorial comes down to personal preference, with all respect. I do understand what you're mentioning but the only thing I did was create a public function to return the value of a private function within the class. I did this in order to support the private function already used in various files of the source.

Basicly what I did was nothing less than,

private:
    [ . . .]
    bool __DirectEnterMode_IsSet(); // -> { return m_kDirectEnterMode.m_isSet; }
public:
    bool DirectEnterMode_IsSet() { return m_kDirectEnterMode.m_isSet; /* __DirectEnterMode_IsSet(); */ }
// Usually, 2 (two) underscores before a function name indicates that it's a private function, thus the reason I created a new one with the same name without the underscores.

But sure, you can also just change the __DirectEnterMode_IsSet to public if you like.

Again, the seccond thing that you citated comes down to personal preference and there isn't any correction to do in the tutorial.
In case you didn't notice, the line I added the IsLoadingPhase function is inside a public method as you can see in the screenshot below.

P4m5eJG.jpeg

Sorry @ReFresh

// There was a little misunderstanding from my part, I noticed that in the first tutorial I did, I said to search,
public:
	bool __DirectEnterMode_IsSet();
// But the correct thing to search is just,
	bool __DirectEnterMode_IsSet();
Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • 0
  • Premium
Posted (edited)

@ Owsap I just mentioned that bool __DirectEnterMode_IsSet(); is in private class, so if you will search public: bool __DirectEnterMode_IsSet();  you won't find it because by default it's private: bool __DirectEnterMode_IsSet(); that was the correction in your tutorial, yeah, almost useless correction, but for copy&paste people can be hard to find it since you can't find it by search bar, because it's in private class 🤣

And for the second thing the correction was only for visual purpose, it looks better along other voids🤔

Edited by ReFresh

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • 0
  • Nitro Booster
1 minute ago, ReFresh said:

@ Owsap I just mentioned that bool __DirectEnterMode_IsSet(); is in private class, so if you will search public: bool __DirectEnterMode_IsSet();  you won't find it because by default it's private: bool __DirectEnterMode_IsSet(); that was the correction in your tutorial, yeah, almost useless correction, but for copy&paste people can be hard to find it since you can't find it by search bar, because it's in private class 🤣

And for the second thing the correction was only for visual purpose, it looks better along other voids 🤔

You're right, I just noticed that I mistakenly left "public" above the function to search. Sorry for the misunderstanding! 🥸

Link to comment
Share on other sites

  • 0

Thank you guys for helping out. @ Owsap i've tested your solution and its working as i wanted, thank you!

Meanwhile the developer of the given system checked the code and modified it, its under testing. I guess this fixes a lot of exploiting since its not a good thing to interrupt the loading phase (in my opinion) so i implemented it anyways. 

 

 

Link to comment
Share on other sites

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


  • Activity

    1. 993

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

    2. 1

      Looking for a good designer

    3. 0

      Cross channel friend request

    4. 2

      Where are those maps/dungeons coming from?

    5. 3

      Press F10 to close the client immediately

    6. 2

      Where are those maps/dungeons coming from?

    7. 2

      Where are those maps/dungeons coming from?

    8. 4

      Visual studio 2022 compiling issue

    9. 1

      Count players function

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.