Skip to content

[Share][Fix]Attacking in peace zone!

Featured Replies

hello all... before my post i have search on forum about like that.. but i don't have find anything like that.

-----------------------------

1)Is easy Code!

2)Work!

 

go to: net.sf.l2j.gameserver.model.clientpackets

open file attackrequest.java

 

after that:

protected void runImpl()
{
	L2PcInstance activeChar = getClient().getActiveChar();
	if (activeChar == null) return;

 

add that:


+		// Peace Zone Attack Exploit Fix
+		//player can hit mobs(etc) but no players
+		L2PcInstance ptarget = (L2PcInstance)activeChar.getTarget();
+      	if (ptarget.isInsideZone(L2Character.ZONE_PEACE))
+       	{
+      		activeChar.sendMessage("[Guard]: You cant attack player in Peace Zone");
+			activeChar.sendPacket(new ActionFailed());
+			return;
+       }
+
	// avoid using expensive operations if not needed

 

i know is easy code but work fine :)

 

  • Author

This is the code that dont allows to players hit NPCs in towns?

with that code don't allow hit players if players is in peace zone..

 

check the trick:

 

(trick: Stun one mob and change fast target you start attack with normal hit you new target..)

 

Nice.

 

But the message you entered is not needed.

hmm interested share..

Thank you very much.

  • 2 months later...

hello all... before my post i have search on forum about like that.. but i don't have find anything like that.

-----------------------------

1)Is easy Code!

2)Work!

 

go to: net.sf.l2j.gameserver.model.clientpackets

open file attackrequest.java

 

after that:

protected void runImpl()
{
	L2PcInstance activeChar = getClient().getActiveChar();
	if (activeChar == null) return;

 

add that:


+		// Peace Zone Attack Exploit Fix
+		//player can hit mobs(etc) but no players
+		L2PcInstance ptarget = (L2PcInstance)activeChar.getTarget();
+      	if (ptarget.isInsideZone(L2Character.ZONE_PEACE))
+       	{
+      		activeChar.sendMessage("[Guard]: You cant attack player in Peace Zone");
+			activeChar.sendPacket(new ActionFailed());
+			return;
+       }
+
	// avoid using expensive operations if not needed

 

i know is easy code but work fine :)

 

working???? yes its working but its bugged... if someone have townwar event  or a event in town... and the pet Bug: you can leave your pet in peace zone with out getting damage the pet... half damage  goes to nobody and you will getting the half damage in game the mage will be like a super man with half damage... here is the fix:

 

if (ptarget.isInsideZone(L2Character.ZONE_PEACE))

                {

                L2PetInstance pet = (L2PetInstance)getPet();

                if (!activeChar.isInFunEvent() || !ptarget.isInFunEvent() || !(pet !=null))

                {

                activeChar.sendMessage("[Guard]: You cant attack player in Peace Zone");

                activeChar.sendPacket(new ActionFailed());

                return;

                }

my oppinion: you can add it in l2pcinstance doAttack its better...

if i am wrong correct me... :P

 

 

If you 're open to few suggestions,i can provide you with the most suitable fix.

First of all,attack is caused by skill intention.There are several skills that force the character to attack when the casting is finished.

 

I believe the problem is in L2Character/void onMagicFinalizer

Just change this line:

	if (skill.getSkillType() == SkillType.PDAM || skill.getSkillType() == SkillType.BLOW 
			|| skill.getSkillType() == SkillType.DRAIN_SOUL || skill.getSkillType() == SkillType.SOW 
			|| skill.getSkillType() == SkillType.SPOIL)
	{
-			if ((getTarget() != null) && (getTarget() instanceof L2Character))
+                       if ((getTarget() != null) && (getTarget() instanceof L2Character) && targets[0] == getTarget())
			getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getTarget());
	}

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.