Jump to content

Recommended Posts

Guest Elfocrash
Posted

There is a faster and better way to do with with chance and not with switch and cases.

 

Good idea though.

Posted

There is a faster and better way to do with with chance and not with switch and cases.

 

Good idea though.

ty elfo :P i like this way :) by the way you mean this faster way?

 

int rnd = Rnd.get(100);

 

if(rnd < chance)?

 

anyway i like the case more

Posted

The chance should have been made in the proper way. I mean the way you enchant with scrolls.

 

Also the check for the gold bars must be put before the switch statement, otherwise the player might get trolled :P.

 

Good job.

Posted

The chance should have been made in the proper way. I mean the way you enchant with scrolls.

 

Also the check for the gold bars must be put before the switch statement, otherwise the player might get trolled :P.

 

Good job.

ty An4rchy :)

 

if i will put it before they will lose 4 gold bars for nothing, hmmm i don't know think about it and answer me... :P

Edit:i forgot that: i don't want with the "clasic" way i want something mine, because if i will add the "clasic" way they will say that i just copy it from the client packet... && is custom :P

Posted

Edit:i forgot that: i don't want with the "clasic" way i want something mine, because if i will add the "clasic" way they will say that i just copy it from the client packet... && is custom :P

Oh ok then :)

 

if i will put it before they will lose 4 gold bars for nothing, hmmm i don't know think about it and answer me... :P

Not really, you can do it like this:

if (activeChar.getInventory().getItemByItemId(3470) == null || activeChar.getInventory().getItemByItemId(3470).getCount() < 4)

{

      activeChar.sendMessage("You need 4 gold bars to use this.");

      return false;

}

 

And under case 5, you will remove this GoldBars boolean.

 

This is just to inform players that they don't have the gold bars before the switch statement. Otherwise they might be pressing the command for 2 minutes(till they get case 5) and get trolled :P

 

Another thing i just checked... Do you want players to use it whenever they want, or if they use it 4 gold bars to be taken(despite if they got case 5)?

Posted

Oh ok then :)

Not really, you can do it like this:

if (activeChar.getInventory().getItemByItemId(3470) == null || activeChar.getInventory().getItemByItemId(3470).getCount() < 4)

{

      activeChar.sendMessage("You need 4 gold bars to use this.");

      return false;

}

 

And under case 5, you will remove this GoldBars boolean.

 

This is just to inform players that they don't have the gold bars before the switch statement. Otherwise they might be pressing the command for 2 minutes(till they get case 5) and get trolled :P

 

Another thing i just checked... Do you want players to use it whenever they want, or if they use it 4 gold bars to be taken(despite if they got case 5)?

updated :)
Posted

    final int GoldBarID = 3470;

    final int GoldBarCount = 4;

 

    final L2ItemInstance Weapon = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);

    final int MaxEnchant = Config.ENCHANT_WEAPON_MAX; 

    final boolean CheckGoldBars = activeChar.getInventory().getItemByItemId(GoldBarID) == null || activeChar.getInventory().getItemByItemId(GoldBarID).getCount() < GoldBarCount;

    final boolean ActiveWeapon = activeChar.getActiveWeaponInstance() != null;

    final boolean MaxEnchantAllowed = activeChar.getActiveWeaponInstance().getEnchantLevel() < MaxEnchant;

    final boolean isNotRoDWeapon = activeChar.getActiveWeaponInstance().getItem().getItemType() != L2WeaponType.ROD;

    final boolean isInInvetory = Weapon.getLocation() == L2ItemInstance.ItemLocation.INVENTORY;    

    final boolean isParedol = Weapon.getLocation() == L2ItemInstance.ItemLocation.PAPERDOLL;

    final boolean itsMyWeapon = Weapon.getOwnerId() == activeChar.getObjectId();

 

These should be under the if (command bla bla check. There isn't something wrong with them, just saying for cleaner code.

 

Also, what about that ; at the end of this check:

if(command.startsWith("WepEnchant") && activeChar != null && activeChar.isOnline() == 1 && !activeChar.isOffline() || !activeChar.isFlying() || !activeChar.isAlikeDead() || !activeChar.is-beep-ted() || !activeChar.isInOlympiadMode() || !activeChar.isSitting());

:S

 

Another error:

else if (CheckGoldBars)

{

      activeChar.sendMessage("You need "+GoldBarCount+" gold bars to use this voiced command ");

      return false;

}

else

 

It needs to be if .... else. It can't start with else if.

Posted

Hmmm..nice share..good idea..:)

 

Stop post counting son (This is the last warn)

 

Ontopic : Impressive and well thought.

Posted

    final int GoldBarID = 3470;

    final int GoldBarCount = 4;

 

    final L2ItemInstance Weapon = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);

    final int MaxEnchant = Config.ENCHANT_WEAPON_MAX; 

    final boolean CheckGoldBars = activeChar.getInventory().getItemByItemId(GoldBarID) == null || activeChar.getInventory().getItemByItemId(GoldBarID).getCount() < GoldBarCount;

    final boolean ActiveWeapon = activeChar.getActiveWeaponInstance() != null;

    final boolean MaxEnchantAllowed = activeChar.getActiveWeaponInstance().getEnchantLevel() < MaxEnchant;

    final boolean isNotRoDWeapon = activeChar.getActiveWeaponInstance().getItem().getItemType() != L2WeaponType.ROD;

    final boolean isInInvetory = Weapon.getLocation() == L2ItemInstance.ItemLocation.INVENTORY;    

    final boolean isParedol = Weapon.getLocation() == L2ItemInstance.ItemLocation.PAPERDOLL;

    final boolean itsMyWeapon = Weapon.getOwnerId() == activeChar.getObjectId();

 

These should be under the if (command bla bla check. There isn't something wrong with them, just saying for cleaner code.

 

Also, what about that ; at the end of this check:

if(command.startsWith("WepEnchant") && activeChar != null && activeChar.isOnline() == 1 && !activeChar.isOffline() || !activeChar.isFlying() || !activeChar.isAlikeDead() || !activeChar.is-beep-ted() || !activeChar.isInOlympiadMode() || !activeChar.isSitting());

:S

 

Another error:

else if (CheckGoldBars)

{

      activeChar.sendMessage("You need "+GoldBarCount+" gold bars to use this voiced command ");

      return false;

}

else

 

It needs to be if .... else. It can't start with else if.

check the code again is not error

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


  • Posts

    • Where's the proof? I can tell you're a scammer.
    • Where was I called a scammer? Is there any proof, etc.? There are a lot of reviews about our store online, etc. https://zhyk.org/forum/showthread.php?t=1108673
    • U was reported as scammer in your previos topic why u create new topic?
    • 🔍 Inventory 1.0 is a next-generation inventory system that stands out with its special minimal clothing system. Carefully designed and prepared according to the highest standards of your server, it not only enhances your gaming experience but also contributes to your server's infrastructure. ⚙️ Supported: QB-CORE Features: ✅ Instant Delivery: All products you purchase will be instantly assigned to your account as soon as your payment is completed. ✅ Clothing System: With the special animated clothing configurations in your inventory, you will be able to change outfits with ease. Experience a unique roleplaying experience with high-quality animations and customizable clothing options. ✅ Minimalist Inventory System: This inventory system, with its visuals, animations, and mechanics, offers maximum efficiency without overwhelming your screen and limiting your roleplaying experience. It’s designed to be user-friendly while enhancing your roleplaying experience. ✅ Continuous Updates: The content in the inventory is regularly updated with innovative features added. New animations, additional clothing options, and cutting-edge features ensure a fresh and dynamic experience. ✅ Easy Setup and Compatibility: Compatible with QB-CORE, this system is easy to install and optimized for quick integration into your server. It works seamlessly with a simple drag-and-drop method. ✅ Performance Optimization: The system is optimized to avoid low FPS and performance drops. All features of the inventory run smoothly without affecting your server’s performance. ✅ Multilingual Support: With support for different languages, you can cater to an international player base and build a larger community on your server. ✅ Flexible Customization Options: You can fully customize the inventory according to your needs and server rules. Choose between different outfits and animations to create a unique gaming experience. ✅ Comprehensive Help and Support: With 24/7 support, you can quickly resolve any issues you encounter. Our technical support and user guides are always here to assist you. Shop Now! Take your game to the next level with Inventory 1.0  and enjoy its unique features. Get ready to make a real difference in your roleplaying experience!   --------------------------TEBEX: https://matza.tebex.io/package/7174862 --------------------------
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock