Jump to content

How to make GM not being able to attack players while using /inv ?


Go to solution Solved by Syreldar,

Recommended Posts

Hello! 

I need the staff members to not be able to hit players while being in the invisibility state.(/inv)

can anyone help me out with this, please? ❤️

Edited by Rev Arena
  • Honorable Member
  • Solution

1. Clientside:

Srcs/Client/InstanceBase.cpp

bool CInstanceBase::IsAttackableInstance(CInstanceBase& rkInstVictim)
{
	//
	else if (IsPC())
	{
		if (rkInstVictim.IsStone())
			return true;

		if (rkInstVictim.IsPC())
		{
			// ADD This here:
			if (IsAffect(AFFECT_INVISIBILITY))
				return false;
	//
//

 

2. Serverside:

Srcs/game/src/pvp.cpp:

bool CPVPManager::CanAttack(LPCHARACTER pkChr, LPCHARACTER pkVictim)
{
	//
	if (pkChr == pkVictim) // ³»°¡ ³¯ Ä¥¶ó°í ÇÏ³× -_-
		return false;

	if (pkVictim->IsNPC() && pkChr->IsNPC() && !pkChr->IsGuardNPC())
		return false;

	// Add this here:
	if (pkChr->IsAffectFlag(AFF_INVISIBILITY) && pkVictim->IsPC())
		return false;
	//
//

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Thank you!!  

Also: i have a question about a post i've seen here a long ago but i can;t find it anymore.

If ninja on Stealth mode or /inv command used the mobs not to attack you anymore.

do you know the post or the fix for it?

  • Active+ Member
8 minutes ago, Rev Arena said:

Thank you!! 

@Rev Arena Don't forget to add IsGM() check to have that working only for Game Masters.

Edited by ReFresh

I'll be always helpful!  😉

  • Honorable Member
1 minute ago, ReFresh said:

@Rev Arena Don't forget to add a IsGM() check to have that working only for GameMasters.

 

AFF_INVISIBILITY Is the affect given by /inv, Ninjas have EUNHYUNG. So it's not necessary.

Edited by Syreldar

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

  • Active+ Member

@SyreldarI'm not 100% sure, but in game is one fish & item, which can give you invisibility and it's probably using the AFF_INVISIBILITY too.

I'll be always helpful!  😉

11 minutes ago, Rev Arena said:

Thank you!!  

Also: i have a question about a post i've seen here a long ago but i can;t find it anymore.

If ninja on Stealth mode or /inv command used the mobs not to attack you anymore.

do you know the post or the fix for it?

i found it! ?

Just now, ReFresh said:

@SyreldarI'm not 100% sure, but in game is one fish & item, which can give you invisibility and it's probably using the AFF_INVISIBILITY too.

i tested it without any code modifications on ninja's EUNHYUNG, also game master and vip's /inv (which is based as an extension of staff priviledges (isGM and isVIP) and it works fine.

I haven't tested on fish/item

  • Honorable Member
2 minutes ago, ReFresh said:

@SyreldarI'm not 100% sure, but in game is one fish & item, which can give you invisibility and it's probably using the AFF_INVISIBILITY too.

Yes, USE_INVISIBILITY. But I am pretty sure he also wanted that taken into account, after all taking damage and bouncing left and right while seeing no one hitting you looks pretty bad.

  • Love 1

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

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.