Jump to content
×
×
  • Create New...

Skills & PvP Block on Specific Maps


Recommended Posts

M2 Download Center

Hidden Content

    Give reaction to this post to see the hidden content.
( 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 4
  • Love 13
  • Love 1
  • Good 1
Link to comment
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 3
Link to comment

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

Announcements

  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021


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.