Jump to content

Skills & PvP Block on Specific Maps


Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

For who want in client-side:

Spoiler


//@svn/Source/Client/UserInterface/InstanceBaseBattle.cpp
//1.) Search:
bool CInstanceBase::NEW_UseSkill(UINT uSkill, UINT uMot, UINT uMotLoopCount, bool isMovingSkill)
{
//2.) Add bellow:
#ifdef ENABLE_FEATURES_BLOCK_SKILL
	static std::string uCurrentMap = CPythonBackground::Instance().GetWarpMapName();
	static std::string uArrayListOfMaps[] = {
		"metin2_map_a1",
		"metin2_map_b1",	/* loaded from atlasinfo.txt */
		"metin2_map_c1"
	}; 		
	
	for (int i=0;i<_countof(uArrayListOfMaps);i++)
	{
		if (!IsGameMaster() && (!uCurrentMap.compare(uArrayListOfMaps[i])))
		{
			TraceError("CInstanceBase::UseSkill on map %s was blocked.", uArrayListOfMaps[i].c_str());
			return false;
		}
	}
#endif

 

For who want in server-side:

Spoiler


//@svn/Server/game/src/game/char_skill.cpp
//1.) Search:
	if (0 == dwSkillVnum) return false;
//2.) Add bellow:
#ifdef ENABLE_FEATURES_BLOCK_SKILL
	static int arrayMapIndex[] = {
		1, 21, 41 /* loaded from map/index.txt */
	}; 		
	
	for (int i=0;i<_countof(arrayMapIndex);i++)
	{
		if (!IsGM() && GetMapIndex() == arrayMapIndex[i])
		{
			ChatPacket(CHAT_TYPE_NOTICE, "CHARACTER::UseSkill on mapIndex %d was blocked.", arrayMapIndex[i]);
			return false;
		}
	}
#endif

 

 

  • Metin2 Dev 13
  • Good 3
  • Love 4
  • Love 21
Link to comment
Share on other sites

27 minutes ago, Jorila said:

You are great. :)
can you add  a "anti pvp function" for any maps? :D

example: user @VegaS cannot attack User @martysama0134 but user @VegaS can attack a mob/stone/boss - for farmmaps

Of course.

Spoiler

//@svn/Source/Client/UserInterface/PythonPlayerEventHandler.cpp
//1.) Search:
void CPythonPlayerEventHandler::OnHit(UINT uSkill, CActorInstance& rkActorVictim, BOOL isSendPacket)
{
//2.) Add bellow:
	static std::string uCurrentMap = CPythonBackground::Instance().GetWarpMapName();
	static std::string uArrayListOfMaps[] = {
		"metin2_map_a1",
		"metin2_map_b1",	/* loaded from atlasinfo.txt */
		"metin2_map_c1"
	}; 		
	
	for (int i=0;i<_countof(uArrayListOfMaps);i++)
	{
		if (rkActorVictim.IsPC() && (!uCurrentMap.compare(uArrayListOfMaps[i])))
		{
			TraceError("CPythonPlayerEventHandler::OnHit on map %s was blocked because players is protected.", uArrayListOfMaps[i].c_str());
			return;
		}
	}

//3.) And add on first line or where you want:
#include "PythonBackground.h"

 

 

  • Love 4
Link to comment
Share on other sites

Announcements



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