Jump to content
  • 0

[SOLVED]UseItem


Question

Posted

Hey, how i can check if a player is in a specific zone ive created, i want to check the zone ID ive tried "activeChar.isInsideZone(ZONE ID)" but i dont think it work :s

 

Any help?

 

Ty in advance

9 answers to this question

Recommended Posts

  • 0
Posted

It's correct...

when the zone is added to L2Character:

/** Zone system */
public static final byte ZONE_PVP = 0;

you can check it with:

if (activeChar.isInsideZone(L2Character.ZONE_PVP))

  • 0
Posted

Ive made a code to unequip some items based on item ID, OnEnter in a zone ive created, how i can restrict it in the UseItem.java, it is not working this way :s

  • 0
Posted

Is there any way to check if player do any action, like move, or smt?

 

i can check ppl item OnEnter(), but if they enter with noob items and them equip the forbid ones it dont take action, if i could check if they move or smt it would be better..

 

any help?

  • 0
Posted

In the zone itself, you put a code to unequip stuff in onEnter section.

 

In UseItem, you put a code to return in case you use itemId = xxxx in zone xx.

 

The prob is that i cant recall the zone to UseItem, i dont know how, ive tried if(activeChar.isInsideZone(ZONEID) didnt work, can u show me how to make it? or an exemple plz..

 

thx

  • 0
Posted

isInsideZone( works with zone CATEGORIES (as shown ^Wyatt in his post), X/Y, or X/Y/Z (cf. from an Object). The complete list of possible zones categories IDs can be found on L2Character.java, for instance, on aCis (my pack) it's :

 

	/** Zone system */
public static final byte ZONE_PVP = 0;
public static final byte ZONE_PEACE = 1;
public static final byte ZONE_SIEGE = 2;
public static final byte ZONE_MOTHERTREE = 3;
public static final byte ZONE_CLANHALL = 4;
public static final byte ZONE_NOLANDING = 5;
public static final byte ZONE_WATER = 6;
public static final byte ZONE_JAIL = 7;
public static final byte ZONE_MONSTERTRACK = 8;
public static final byte ZONE_CASTLE = 9;
public static final byte ZONE_SWAMP = 10;
public static final byte ZONE_NOSUMMONFRIEND = 11;
public static final byte ZONE_NOSTORE = 12;
public static final byte ZONE_TOWN = 13;
public static final byte ZONE_SCRIPT = 14;
public static final byte ZONE_HQ = 15;
public static final byte ZONE_DANGERAREA = 16;
public static final byte ZONE_CASTONARTIFACT = 17;
public static final byte ZONE_NORESTART = 18;

 

About check on a ZONEID, and not a ZONE CATEGORY, you have to use

 

public FastList<L2ZoneType> getZones(int x, int y, int z)
{
	L2WorldRegion region = L2World.getInstance().getRegion(x, y);
	FastList<L2ZoneType> temp = new FastList<>();
	for (L2ZoneType zone : region.getZones())
	{
		if (zone.isInsideZone(x, y, z))
			temp.add(zone);
	}
	return temp;
}

 

It can then be used to find a particular area, such a town area in following method :

 

public final static L2TownZone getTown(int x, int y, int z)
{
	for (L2ZoneType temp : ZoneManager.getInstance().getZones(x, y, z))
	{
		if (temp instanceof L2TownZone)
		{
			return (L2TownZone) temp;
		}
	}
	return null;
}

 

You can retrieve a zone by its ID with

	public L2ZoneType getZoneById(int id)
{
	for (Map<Integer, ? extends L2ZoneType> map : _classZones.values())
	{
		if (map.containsKey(id))
			return map.get(id);
	}
	return null;
}

And then launch particular code from that zone.

  • 0
Posted

Still cant make it to work, i have the code "OnEnter" to unequip the items, and ye it unequip when they port in, but they can be re equiped, so i think the prob is in UseItem still cant connect the zone i want with the method, i cant figure it out, sorry bieng so noob. :s

Guest
This topic is now closed to further replies.


  • Posts

    • Inventory restock: Premium business accounts are now available.   ✔ Wallester Business EU 🇪🇺|💳 Unlimited virtual cards, physical cards, 🏦 multi-currency IBAN, ₿ crypto & stablecoin deposits. ✔ Stripe Business UK 🇬🇧|💳 Instant virtual cards (Visa/Mastercard), high-conversion checkout, multi-currency payouts, ₿ crypto payments, no-code payment links. ✔ Mercury Business US 🇺🇸|🏦 US checking & savings, 💳 unlimited virtual cards, domestic & International wires, native stablecoin settlement. ✔ Payset Business EU 🇪🇺|🏦 Multiple IBANs, UK sort code, SEPA Instant, 💳 unlimited virtual cards, multi-currency accounts. ✔ Novo Business US 🇺🇸|🏦 Business checking account, ACH payments & invoicing, 💳 virtual & physical cards, novo boost.
    • Let me see if I understand correctly, older gentlemen, when a newcomer shows up to create modern things with the help of AI, doing what you charge them to do, you point the finger and laugh. I believe that's why everything is stagnant. The product isn't for programming experts, it's for newcomers. Don't buy from you if they can do it themselves using this base. You're going to deliver a similar product, maybe even worse than this one, so why are you complaining? PowerShell, as you well know, started with it, then came new platforms and new apps, new creation models, all with different languages; I chose the simplest one for my taste. This is about being organized and knowing how to choose the right words for each situation. It's not 100%, but it already gives a good impression. Nothing is 100%, so a topic written by AI, and all the code that you charge an absurd amount for to prohibit and sell hacks, could be open source so that everyone can create new practices, new models, new information for passing packets, prohibiting the use of cheats that cause server owners to break so much. Let's remember that the Admin doesn't always shut down the server; it's the players who find problems and take advantage by buying and reselling items, and they say that the GM shuts down the server every week, but that's a lie. What they do is duplicate items with packages and sell them, but perhaps this could give some future developers a starting point to create their own protection following the model in the initial documentation. Because none of you answer a question from a newbie, you think you're superior because you have knowledge, but with AI, people like that can have the same knowledge as you, but with less practice. And if they practice a lot, 10,000 hours, they can be as good as all of you older developers in the L2J field.
    • ✨ Exclusive Offer for Marketplace Growth 🔥 Elevate your performance with a premium bonus. 💲 Top up your balance with $100 or more and receive an additional $5 credit — seamlessly added to your account. ⭐️ Designed for those who value efficiency, scale, and results. ⚡️ Effortless. Refined. Effective. 💥 Enhance your strategy today 💥
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and 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..