Jump to content

SPAM MOUNT BUG (CTRL+F)


Go to solution Solved by Mr.Black,

Recommended Posts

  • Premium

Hello, I found a bug when you use this system:

Spoiler

 

 

You can spam ctrl f g and you create lag on the server like this:

 

Spoiler

int MountSpam = ch->GetQuestFlag("mount.spam");
if (MountSpam)
{
    /* code */
    if (get_global_time() < MountSpam + 5)
    {
        /* code */
        ch->ChatPacket(CHAT_TYPE_INFO, "WAIT 5 SECONDS");
        return;
    }
}
ch->SetQuestFlag("mount.spam", get_global_time());

 

 

Spoiler

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
https://metin2.dev/topic/23389-spam-mount-bug-ctrlf/
Share on other sites

  • Premium
13 minutes ago, Gurgarath said:

tell me more

I thought I solved it but it still an problem.

but I dont know how to make it when you go up to it 5 times after that it will block you 5 seconds.

 

Edit:

int MountSpam = ch->GetQuestFlag("mount.spam");
if (MountSpam)
{
	/* code */
	if (get_global_time() < MountSpam + 5)
	{
		/* code */
		ch->ChatPacket(CHAT_TYPE_INFO, "WAIT 5 SECONDS");
		return;
	}
}
ch->SetQuestFlag("mount.spam", get_global_time());

 

@Gurgarath

Edited by DemOnJR
  • Love 1
Link to comment
https://metin2.dev/topic/23389-spam-mount-bug-ctrlf/#findComment-126135
Share on other sites

  • Solution
1 minute ago, DemOnJR said:

I thought I solved it but it still an problem.

but I dont know how to make it when you go up to it 5 times after that it will block you 5 seconds.

@Gurgarath


Selfish
I will never give u t ...

  • Love 1
Link to comment
https://metin2.dev/topic/23389-spam-mount-bug-ctrlf/#findComment-126136
Share on other sites

  • 5 years later...

Little late to the party, but here's my take.
 

	// Prevent user spam if used more than 6 times in a 5 second window
	const int mountSpam = ch->GetQuestFlag("mount.spam");
	int mountSpamTimeout = ch->GetQuestFlag("mount.spam_timeout");
	const long globalTime = get_global_time();

	if (mountSpam >= 6 || mountSpamTimeout != 0)
	{
		if (mountSpamTimeout == 0) {
			ch->SetQuestFlag("mount.spam_timeout", globalTime);
			mountSpamTimeout = globalTime;
		}
		ch->SetQuestFlag("mount.spam", 0);
		if (globalTime < mountSpamTimeout + 5)
		{
			ch->ChatPacket(CHAT_TYPE_INFO, "WAIT 5 SECONDS");
			return;
		}
		ch->SetQuestFlag("mount.spam_timeout", 0);
	}

	ch->SetQuestFlag("mount.spam", std::max(mountSpam + 1, 1));

Let me know if you have a better solution.

Link to comment
https://metin2.dev/topic/23389-spam-mount-bug-ctrlf/#findComment-172498
Share on other sites

On 10/7/2025 at 1:30 PM, Trukken said:

Little late to the party, but here's my take.
 

	// Prevent user spam if used more than 6 times in a 5 second window
	const int mountSpam = ch->GetQuestFlag("mount.spam");
	int mountSpamTimeout = ch->GetQuestFlag("mount.spam_timeout");
	const long globalTime = get_global_time();

	if (mountSpam >= 6 || mountSpamTimeout != 0)
	{
		if (mountSpamTimeout == 0) {
			ch->SetQuestFlag("mount.spam_timeout", globalTime);
			mountSpamTimeout = globalTime;
		}
		ch->SetQuestFlag("mount.spam", 0);
		if (globalTime < mountSpamTimeout + 5)
		{
			ch->ChatPacket(CHAT_TYPE_INFO, "WAIT 5 SECONDS");
			return;
		}
		ch->SetQuestFlag("mount.spam_timeout", 0);
	}

	ch->SetQuestFlag("mount.spam", std::max(mountSpam + 1, 1));

Let me know if you have a better solution.

Looking back at it, it's actually garbage code.
Do this instead:
service.h
 

#define ENABLE_BLOCK_RIDE_SPAM                          // < Block Do Ride Spam


char.h
 

// Search
const CHARACTER_SET& GetChainLightingExcept() const { return m_setExceptChainLighting; }

// Add after

#ifdef ENABLE_BLOCK_RIDE_SPAM
		int					m_iRideSpamBlockAfter;
		int					m_iRideSpamTime;
#endif

 

cmd_general.cpp

// Search, the curly bracket { might be on the same line!
ACMD(do_ride)
{

// Add BEFORE
#ifdef ENABLE_BLOCK_RIDE_SPAM
/**
 * Determine wether the player is spamming do_ride
 */
bool isLimitedToMount(LPCHARACTER ch){
	constexpr int timeoutSeconds = 5;

	if ((thecore_pulse() < (ch->m_iRideSpamTime + timeoutSeconds * 25)))
	{
		if (ch->m_iRideSpamBlockAfter < 6)
		{
			ch->m_iRideSpamBlockAfter++;
			return false;
		}

		return true;
	}

	ch->m_iRideSpamBlockAfter = 0;

	ch->m_iRideSpamTime = thecore_pulse();
	return false;
}
#endif

// Now go back to
ACMD(do_ride)
{
  
// Add AFTER
#ifdef ENABLE_BLOCK_RIDE_SPAM
	if (isLimitedToMount(ch)) {
		ch->ChatPacket(CHAT_TYPE_INFO, "WAIT 5 SECONDS");
		return;
	}
#endif


Pros:
- It actually works
- Uses memory instead of DB
- Won't get an integer overflow at Epochalypse

Link to comment
https://metin2.dev/topic/23389-spam-mount-bug-ctrlf/#findComment-172517
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.