Jump to content

How To Serverside Anticheat Guide


Recommended Posts

  • Active Member

M2 Download Center

This is the hidden content, please
This is the hidden content, please
This is the hidden content, please
This is the hidden content, please
This is the hidden content, please
This is the hidden content, please

Anti Wait Hack:

 

Spoiler

Anti Safezone:

 

Spoiler

*char_battle.cpp

Find:


bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType)
{
	if (test_server)
		sys_log(0, "[TEST_SERVER] Attack : %s type %d, MobBattleType %d", GetName(), bType, !GetMobBattleType() ? 0 : GetMobAttackRange());
	//PROF_UNIT puAttack("Attack");
	if (!CanMove())
		return false;

Add it under:


	SECTREE	*sectree = NULL;
	SECTREE	*vsectree = NULL;
	sectree = GetSectree();
	vsectree = pkVictim->GetSectree();

	if (sectree && vsectree){
		if (sectree->IsAttr(GetX(), GetY(), ATTR_BANPK) || vsectree->IsAttr(pkVictim->GetX(), pkVictim->GetY(), ATTR_BANPK)) {
			if (GetDesc()) {
				LogManager::instance().HackLog("ANTISAFEZONE", this);
				GetDesc()->DelayedDisconnect(3);
			}
		}
	}

 

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

Anti Ghostmode:

 

Spoiler

*input_main.cpp

Find:


if (!test_server)	//2012.05.15 ±è¿ë¿í : Å×¼·¿¡¼­ (¹«Àû»óÅ·Î) ´Ù¼ö ¸ó½ºÅÍ »ó´ë·Î ´Ù¿îµÇ¸é¼­ °ø°İ½Ã ÄŞº¸ÇÙÀ¸·Î Á×´Â ¹®Á¦°¡ ÀÖ¾ú´Ù.

Add it under:


		if (ch->IsPC() && ch->IsDead()) {
			if (ch->GetDesc()) {
				LogManager::instance().HackLog("GHOSTMODE", ch);
				ch->GetDesc()->DelayedDisconnect(3);
			}
		}

 

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

Anti Wallhack:

 

Spoiler

*input_main.cpp

Find:


const float fDist = DISTANCE_SQRT((ch->GetX() - pinfo->lX) / 100, (ch->GetY() - pinfo->lY) / 100);

Add it upper:


		PIXEL_POSITION pos = ch->GetXYZ();
		if (!SECTREE_MANAGER::instance().GetMovablePosition(ch->GetMapIndex(), pos.x, pos.y, pos)) {
			if (ch->GetDesc()) {
				LogManager::instance().HackLog("WALLHACK", ch);
				ch->GetDesc()->DelayedDisconnect(3);
			}
		}

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

Anti Long name generator:

 

Spoiler

*input_login.cpp

Find:


	if (true == g_BlockCharCreation)
	{
		d->Packet(&packFailure, sizeof(packFailure));
		return;
	}

Add it under:


	if (strlen(pinfo->name) > 12){
		d->Packet(&packFailure, sizeof(packFailure));
		return;
	}

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

#Update 1:

-Clientside-

 

Spoiler

PythonPlayerModule.cpp


{ "SetItemData",				playerSetItemData,					METH_VARARGS },

*Fake item creator function

PythonItemModule.cpp


{ "CreateItem",						itemCreateItem,							METH_VARARGS },

*Fake item creator function

PythonCharacterModule.cpp


{ "IsGameMaster",				chrIsGameMaster,					METH_VARARGS },

*Gm detector function

Remove this lines, this functions isn't used anywhere

 

-Serverside-

Anti Mining Bot:

 

Spoiler

Original post(Lefloyd @epvp)

*char.cpp

Find:


	if (mining::GetRawOreFromLoad(chLoad->GetRaceNum()) == 0)
		return;

Add it upper:


	if (GetMapIndex() != chLoad->GetMapIndex() || DISTANCE_APPROX(GetX() - chLoad->GetX(), GetY() - chLoad->GetY()) > 1000)
		return;

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

Fishing without water fix

 

Spoiler

Original post(Lefloyd @epvp)

*char.cpp

Find:


void CHARACTER::fishing()

Add it upper:


bool CHARACTER::IsNearWater() const
{
	if (!GetSectree())
		return false;

	for (int x = -1; x <= 1; ++x)
	{
		for (int y = -1; y <= 1; ++y)
		{
			if (IS_SET(GetSectree()->GetAttribute(GetX() + x * 100, GetY() + y * 100), ATTR_WATER))
				return true;
		}
	}

	return false;
}

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

Find:


	if (m_pkFishingEvent)
	{
		fishing_take();
		return;
	}

Add it under:


	if (!IsNearWater())
		return;

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

*char.h

Find:


void			fishing();

Add it upper:


bool			IsNearWater() const;

 

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

Anti Colorful Shop

 

Spoiler

*input_main.cpp

Find:


	if (uiBytes < sizeof(TPacketCGMyShop) + iExtraLen)
		return -1;

Add it under:


	if (strstr(p->szSign, ("|c")) || strstr(p->szSign, ("|C"))){
		LogManager::instance().HackLog("COLORFUL_SHOP", ch);
		return (iExtraLen);
	}

 

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

Anti Drophack

 

Spoiler

*char_item.cpp

Find:


LPCHARACTER owner = funcFindOwnership.owner;

Add it under:


			if (!owner) {
				LogManager::instance().HackLog("DROPHACK", this);
				return false;
			}

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

#Update 2:

-Serverside-

Anti Fish Bot

 

Spoiler

*fishing.cpp

Find:


int ret = Compute(info->fish_id, ms, &item_vnum, GetFishingLevel(ch));

Add it under:


		if (!ch->GetLastFishTime())
			ch->SetLastFishTime(ms);
		else {
			if (ch->GetFishHackCount() == 3) {
				ch->ResetFishHackCount();
				LogManager::instance().HackLog("FISHBOT", ch);
				ch->GetDesc()->DelayedDisconnect(3);
			}
			else {
				if ((ms == ch->GetLastFishTime()) || (abs(ch->GetLastFishTime() - ms) < 70) || (abs(ms - ch->GetLastFishTime()) < 70))
					ch->UpdateFishHackCount();
				else
					ch->ResetFishHackCount();
			}
		}

		if (test_server)
			ch->ChatPacket(CHAT_TYPE_INFO, "/HACK-TEST/ Last: %d Now: %d HackCount: %d", ch->GetLastFishTime(), ms, ch->GetFishHackCount());

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

*char.cpp

Find:


m_dwMountTime = 0;

Add it upper:


	m_iLastFishTime = 0;
	m_iFishHackCount = 0;

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

Find:


void CHARACTER::ResetChatCounter()

Add it upper:


void CHARACTER::SetLastFishTime(int time)
{
	m_iLastFishTime = time;
}

int CHARACTER::GetLastFishTime()
{
	return m_iLastFishTime;
}

int CHARACTER::GetFishHackCount()
{
	return m_iFishHackCount;
}

void CHARACTER::UpdateFishHackCount()
{
	m_iFishHackCount += 1;
}

void CHARACTER::ResetFishHackCount()
{
	m_iFishHackCount = 0;
}

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

*char.h

Find:


DWORD GetSkipComboAttackByTime() const;

Add it under:


		int GetFishHackCount();
		void UpdateFishHackCount();
		void ResetFishHackCount();
		void SetLastFishTime(int time);
		int GetLastFishTime();

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

Find:


DWORD m_dwSkipComboAttackByTime;

Add it under:


		int m_iFishHackCount;
		int m_iLastFishTime;

 

Anti Guild Maker(low level)

 

Spoiler

*input_main.cpp

Find:


	if (ch->GetGold() < 200000)
		return;

Add it under:


	if (ch->GetLevel() < 40)
	{
		LogManager::instance().HackLog("GUILDMAKER", ch);
		ch->GetDesc()->DelayedDisconnect(3);
		return;
	}

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

 

Activate Anti Teleport Hack

 

Spoiler

*input_main.cpp

Find:


			if( false == LC_IsEurope() )
			{
				const PIXEL_POSITION & warpPos = ch->GetWarpPosition();

				if (warpPos.x == 0 && warpPos.y == 0)
					LogManager::instance().HackLog("Teleport", ch); // ºÎÁ¤È®ÇÒ ¼ö ÀÖÀ½
			}

			sys_log(0, "MOVE: %s trying to move too far (dist: %.1fm) Riding(%d)", ch->GetName(), fDist, ch->IsRiding());

			ch->Show(ch->GetMapIndex(), ch->GetX(), ch->GetY(), ch->GetZ());
			ch->Stop();
			return;

Change:


			const PIXEL_POSITION & warpPos = ch->GetWarpPosition();

			if (warpPos.x == 0 && warpPos.y == 0)
				LogManager::instance().HackLog("Teleport", ch); // ºÎÁ¤È®ÇÒ ¼ö ÀÖÀ½

			sys_log(0, "MOVE: %s trying to move too far (dist: %.1fm) Riding(%d)", ch->GetName(), fDist, ch->IsRiding());

			ch->Show(ch->GetMapIndex(), ch->GetX(), ch->GetY(), ch->GetZ());
			ch->Stop();
			ch->GetDesc()->DelayedDisconnect(0);
			return;

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

 

-Clientside-

Activate py inject protection

 

Spoiler

 

Anti Anti Stun & Anti Visual GM Effect

 

Spoiler

*PythonCharacterManagerModule.cpp

Remove:


{ "SetAffect",					chrmgrSetAffect,						METH_VARARGS },

 

 

Anti Attackspeed & Anti Movespeed

 

Spoiler

*PythonCharacterModule.cpp

Remove this lines:


		{ "SetMoveSpeed",					chrSetMoveSpeed,					METH_VARARGS },
		{ "SetAttackSpeed",					chrSetAttackSpeed,					METH_VARARGS },

 

 

 

This thread subjects enough for general cheats
For better bot and script cheat security change module or function names
For this here basic tutorial for change net module name

 

Spoiler

*PythonNetworkStreamModule.cpp

Search:


PyObject* poModule = Py_InitModule("net", s_methods);

Change to yourselves, example:


PyObject* poModule = Py_InitModule("mt2net", s_methods);

 

Now, Open your all python scripts with Notepad++

Press CTRL+H Open Replace tab

Write to "Find what": import net

Write to "Replace with": import mt2net as net

Save your all scripts and enjoy

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 87
  • kekw 1
  • Eyes 3
  • Dislove 2
  • Sad 1
  • Cry 1
  • Think 1
  • Confused 1
  • Good 35
  • Love 6
  • Love 88
Link to comment
Share on other sites

 

Anti Wait Hack:

Anti Safezone:

*char_battle.cpp

Find:

bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType)
{
	if (test_server)
		sys_log(0, "[TEST_SERVER] Attack : %s type %d, MobBattleType %d", GetName(), bType, !GetMobBattleType() ? 0 : GetMobAttackRange());
	//PROF_UNIT puAttack("Attack");
	if (!CanMove())
		return false;

Add it under:

	SECTREE	*sectree = NULL;
	SECTREE	*vsectree = NULL;
	sectree = GetSectree();
	vsectree = pkVictim->GetSectree();

	if (sectree && vsectree){
		if (sectree->IsAttr(GetX(), GetY(), ATTR_BANPK) || vsectree->IsAttr(pkVictim->GetX(), pkVictim->GetY(), ATTR_BANPK)) {
			if (GetDesc()) {
				LogManager::instance().HackLog("ANTISAFEZONE", this);
				GetDesc()->DelayedDisconnect(3);
			}
		}
	}

 

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

Anti Ghostmode:

*input_main.cpp

Find:

if (!test_server)	//2012.05.15 ±è¿ë¿í : Å×¼·¿¡¼­ (¹«Àû»óÅ·Î) ´Ù¼ö ¸ó½ºÅÍ »ó´ë·Î ´Ù¿îµÇ¸é¼­ °ø°İ½Ã ÄŞº¸ÇÙÀ¸·Î Á×´Â ¹®Á¦°¡ ÀÖ¾ú´Ù.

Add it under:

		if (ch->IsPC() && ch->IsDead()) {
			if (ch->GetDesc()) {
				LogManager::instance().HackLog("GHOSTMODE", ch);
				ch->GetDesc()->DelayedDisconnect(3);
			}
		}

 

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

Anti Wallhack:

*input_main.cpp

Find:

const float fDist = DISTANCE_SQRT((ch->GetX() - pinfo->lX) / 100, (ch->GetY() - pinfo->lY) / 100);

Add it upper:

		PIXEL_POSITION pos = ch->GetXYZ();
		if (!SECTREE_MANAGER::instance().GetMovablePosition(ch->GetMapIndex(), pos.x, pos.y, pos)) {
			if (ch->GetDesc()) {
				LogManager::instance().HackLog("WALLHACK", ch);
				ch->GetDesc()->DelayedDisconnect(3);
			}
		}

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

Anti Long name generator:

*input_login.cpp

Find:

	if (true == g_BlockCharCreation)
	{
		d->Packet(&packFailure, sizeof(packFailure));
		return;
	}

Add it under:

	if (strlen(pinfo->name) > 12){
		d->Packet(&packFailure, sizeof(packFailure));
		return;
	}

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

It will be updated continuously

Thanks KorayB)

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 2
  • Love 5
Link to comment
Share on other sites

  • Premium

Thanks for the update but I have some questions :

Is deleting some functions can cause problem, for example if you use console ";" (for attack speed, or gm effect and so on) ?

And, by the way, is the "Anti Teleport Hack" can cause issues for the couple or the groups (teleport function)

And at last but not least, what is the "Anti colorful shop" ? Because there's a system for coloring shops, otherwise I don't know how to put color on it because a virgin client can't dispaly color on shops / guild

Link to comment
Share on other sites

  • Premium

Only used function is "SetAffect" in console, if you want you can change

Group teleport function isn't using "Move" function

Colorful shop so title colored shop released in epvp but now I dont find thread link, people's put color in shop sign like chat

-EDIT-

Is that the post?

Saw your topic now, thank you alot for all that information.

Edited by Shisui
careful with links
Link to comment
Share on other sites

Only used function is "SetAffect" in console, if you want you can change

Group teleport function isn't using "Move" function

Colorful shop so title colored shop released in epvp but now I dont find thread link, people's put color in shop sign like chat

-EDIT-

Is that the post?

Saw your topic now, thank you alot for all that information.

The title say:  Color shop mark.

You are blind? The title says it all.
When a player opens a shop is labeled to know if it was open or not.

This helps shops Player When controls.

Link to comment
Share on other sites

  • Premium

Only used function is "SetAffect" in console, if you want you can change

Group teleport function isn't using "Move" function

Colorful shop so title colored shop released in epvp but now I dont find thread link, people's put color in shop sign like chat

-EDIT-

Is that the post?

Saw your topic now, thank you alot for all that information.

The title say:  Color shop mark.

You are blind? The title says it all.
When a player opens a shop is labeled to know if it was open or not.

This helps shops Player When controls.

Where im i talking to you?

_

Ok koray

Link to comment
Share on other sites

Hello, 

I implemented following things in my source: Anti Safezone, Anti Ghostmode, Anti Wallhack,Anti Long name generator

Not of any errors, or to compile or when the game is online, but when character dies and clicks back ma account is disconnected, tested with unmodified backup and character is not disconnected, wanted to know why this happens.

Just die and clicking "back here" several times that character is disconnected from the game, some correction?

I apologize for my English.

 

 

 

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

Error    4    error C2374: 'pkInstMain' : redefinition; multiple initialization    C:\Users\Stefan\Desktop\Folder de lucru\client_reboot_dev\source\UserInterface\PythonNetworkStreamPhaseGame.cpp    1129    1    UserInterface
Error    6    error C2374: 'pkInstMain' : redefinition; multiple initialization    C:\Users\Stefan\Desktop\Folder de lucru\client_reboot_dev\source\UserInterface\PythonNetworkStreamPhaseGame.cpp    1139    1    UserInterface
Error    3    error C2374: 'rkChrMgr' : redefinition; multiple initialization    C:\Users\Stefan\Desktop\Folder de lucru\client_reboot_dev\source\UserInterface\PythonNetworkStreamPhaseGame.cpp    1128    1    UserInterface
Error    5    error C2374: 'rkChrMgr' : redefinition; multiple initialization    C:\Users\Stefan\Desktop\Folder de lucru\client_reboot_dev\source\UserInterface\PythonNetworkStreamPhaseGame.cpp    1138    1    UserInterface
Warning    8    warning C4101: 'iSlotPos' : unreferenced local variable    C:\Users\Stefan\Desktop\Folder de lucru\client_reboot_dev\source\UserInterface\PythonPlayerModule.cpp    978    1    UserInterface
Warning    7    warning C4101: 'iSourceSlotIndex' : unreferenced local variable    C:\Users\Stefan\Desktop\Folder de lucru\client_reboot_dev\source\UserInterface\PythonPlayerModule.cpp    763    1    UserInterface
Warning    1    warning C4800: 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)    C:\Users\Stefan\Desktop\Folder de lucru\client_reboot_dev\source\UserInterface\NetworkActorManager.cpp    367    1    UserInterface
Warning    2    warning C4800: 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)    C:\Users\Stefan\Desktop\Folder de lucru\client_reboot_dev\source\UserInterface\NetworkActorManager.cpp    417    1    UserInterface

Probably anti wall hack...

Help?

Edited by daredevil09
Link to comment
Share on other sites

Announcements



  • Similar Content

  • Similar Content

  • Similar Content

  • Tags

  • Activity

    1. 3

      Crystal Metinstone

    2. 3

      Feeding game source to LLM

    3. 113

      Ulthar SF V2 (TMP4 Base)

    4. 3

      Feeding game source to LLM

    5. 0

      Target Information System

    6. 3

      Feeding game source to LLM

    7. 2

      anti exp explanation pls

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