Skip to content

[SHARE]disallow potion in pvp

Featured Replies

Whit this small modification you can disallow potions in pvp

 

go to com.l2jfree.gameserver.handler.itemhandler.potion.java

 

search for this:

 

		if (activeChar.isAllSkillsDisabled())
	{
		activeChar.sendPacket(ActionFailed.STATIC_PACKET);
		return;
	}

 

then after that insert this:

 

		if (activeChar.getPvpFlag() != 0)
	{
		if (item.getItemId() == your itemID)
		{
		    activeChar.sendMessage("You cannot use this in pvp mode!");
		    return;
		}
	}

 

credits to crion for the base code and to me because of some correction

(with crion's code in gracia i get several error message like cannot find symbol and others)

great job! keep it coming!

  • 2 weeks later...

very usefull! Thnx :)

Change to code to this, easier and lessens the load.

 

	if (activeChar.getPvpFlag() != 0 && item.getItemId() == Your Item ID)
	{
		activeChar.sendMessage("You cannot use this in pvp mode!");
		return;
	}

  • Author

disable potion in pvp? :P bad idea!

i dont think it's a bad idea for example disable quick heal potion in high rate server...

or if somebody want to open a low rate without mana pots but he want good play with mage he can enable the mana potion but only for exping.

  • 2 weeks later...
  • 2 months later...

very good,but i need the id from quick healing potion :P

good job...it must be great config...

Code to disable all potions:

	if (activeChar.getPvpFlag() != 0 && item.getItemType() == L2EtcItemType.POTION)
	{
		    activeChar.sendMessage("You cannot use this in pvp mode!");
		    return;
	}

You may need to import L2EtcItemType.java

import com.l2jfree.gameserver.templates.item.L2EtcItemType;

  • Author

Code to disable all potions:

	if (activeChar.getPvpFlag() != 0 && item.getItemType() == L2EtcItemType.POTION)
	{
		    activeChar.sendMessage("You cannot use this in pvp mode!");
		    return;
	}

You may need to import L2EtcItemType.java

import com.l2jfree.gameserver.templates.item.L2EtcItemType;

 

You dont need imports...

just the check so its like

	if (activeChar.getPvpFlag() != 0)
	{
		    activeChar.sendMessage("You cannot use this in pvp mode!");
		    return;
	}

You dont need imports...

just the check so its like

	if (activeChar.getPvpFlag() != 0)
	{
		    activeChar.sendMessage("You cannot use this in pvp mode!");
		    return;
	}

The code i made disallows all potions. So you don't need to specify potion id.

  • Author

The code i made disallows all potions. So you don't need to specify potion id.

 

Man if you write only the check i post it affects all potions :Din the first 1 the itemId is just a plus check to dont disallow all potion only 1...

Create an account or sign in to comment

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.