Jump to content
  • 0

I Have An Error In My Code, But I Can't Spot It.


Question

Posted

Hello everyone and Happy New Year!

 

I thought of making a voice command for gambling. What it does is by typing .luck a window appears and lets you choose an amount of adenas between 1kk, 10kk and 50kk.

You have 50% chance to double them or lose them. However, when I click on a button nothing happens, while the Cancel button works fine. Here is the code:

Luck.java: http://pastebin.com/1MA2VBEH
HTML buttons: http://pastebin.com/71M50bHV

 

It's coded for L2jFrozen Interlude, latest rev (1004).

Thank you for your time reading this. I apologize for my low Java knowledge.

9 answers to this question

Recommended Posts

  • 0
Posted

The problem is solved. I really thank you all for your time and your help!

 

I modified a code from another voicedcommand, which was used via Powerpak. What I did, was add these to Powerpak.java

Luck luck_handler = new Luck();
VoicedCommandHandler.getInstance().registerVoicedCommandHandler(luck_handler);
CustomBypassHandler.getInstance().registerCustomBypassHandler(luck_handler);
System.out.println("Luck is Enabled.");
			
  • 0
Posted

Thank you for your reply! Unfortunately, I didn't get what you mean... I am sorry but I just started using Java. Would it be easy for you to explain a little more?

 

Once again, thank you very much!

  • 0
Posted (edited)

You must create and "if" here : http://svn.l2jserver.com/trunk/L2J_Server/java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java

(check how others are made)

and send the info like "Luck.handleCommand(_command, activeChar);" or whatever

note: better move your java file to core-side to be able to import it, or create a new file inside the core-side and move the handleCommand() thingy there, or put it inside the RequestBypassToServer.java but it would be dirty.

Edited by ^Wyatt
  • 0
Posted

hi man... you've read that you did? here say: 

 

        private enum CommandEnum
        {
                luck,
                luck_close_win 

        }

where say custom_luck (html) ... change that for luck, maybe this bad .. but hey try it XD

  • 0
Posted (edited)

So, it's like

+            // Voiced Bypass
+            else if (_command.startsWith("voiced_"))
+            {
+                String command = _command.split(" ")[0];
+                IVoicedCommandHandler ach = VoicedCommandHandler.getInstance().getVoicedCommandHandler(_command.substring(7));
+                
+                if (ach == null)
+                {
+                    activeChar.sendMessage("The command " + command.substring(7) + " does not exist!");
+                    _log.warning("No handler registered for command '" + _command + "'");
+                    return;
+                }
+                ach.useVoicedCommand(_command.substring(7), activeChar, null);
+            }
action = "bypass -h voiced_luck $luck"

So, by this you will call luck(y) command via npc :P

Edited by SweeTs
  • 0
Posted (edited)

Thank you very much for your replies! However, L2jFrozen has already the custom_ handler implemented. There are other NPCs with custom action. It's only mine that doesn't work :P

 

 

This is what already exists:

else if(_command.startsWith("custom_"))
{
    L2PcInstance player = getClient().getActiveChar();
    CustomBypassHandler.getInstance().handleBypass(player, _command);
}
Edited by G-hamsteR
  • 0
Posted

Then, inside your "public void handleCommand()" make some debug lines to see what's going on.

For example, "System.out.println(command+";"+tryLuck+";"+activeChar.getName());" at the start.

Guest
This topic is now closed to further replies.


  • Posts

    • Hello everyone, this is ADENA L2REBORN / LU4 / MASTERWORK We also have items, epics, etc. discord - adver745645 Our prices are reasonable, so have a nice shopping and a nice day.
    • Dear friends, we are pleased to announce great news — we are launching our new bot for purchasing and renting virtual numbers for receiving SMS from any services! Are you tired of reused or resold numbers from other platforms? Try our solution! Our service allows you to receive SMS from any major popular services. The list includes more than 200 services! SMS receiving country: USA (+1). Real physical US numbers are used — never previously used on other platforms! Currently, only short-term rental is available. The rental duration for each phone number is shown when purchasing. The cost of each number is also shown next to the service before purchase. You can also receive an additional SMS for your number for the selected service (no extra charge for receiving one more SMS). To quickly find the service you need, you can use the convenient search — just type the name of the service you need and get a number for activation. Available payment methods: cryptocurrencies, bank cards, and balance transfer from our other bots. Thank you for your trust! Active links: Virtual Number Service: Go Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store through Telegram messenger. Telegram Bot for purchasing Telegram Stars: Go – fast and profitable purchase of stars in Telegram. SMM Panel: Go – promotion of your social media accounts. We would like to present to you the current list of promotions and special offers for purchasing goods and services from our platform: 1. Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, Bot) during October! You can also use the promo code for your first purchase: SOCNET (15% discount) 2. Get $1 credited to your store balance or a 10–20% discount — simply post your username after registration on our website using the following format: "SEND ME BONUS, MY USERNAME IS..." — post it in our forum thread! 3. Get $1 for your first SMM Panel trial — just open a ticket titled “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our Stars purchasing bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Dear friends, we are pleased to announce great news — we are launching our new bot for purchasing and renting virtual numbers for receiving SMS from any services! Are you tired of reused or resold numbers from other platforms? Try our solution! Our service allows you to receive SMS from any major popular services. The list includes more than 200 services! SMS receiving country: USA (+1). Real physical US numbers are used — never previously used on other platforms! Currently, only short-term rental is available. The rental duration for each phone number is shown when purchasing. The cost of each number is also shown next to the service before purchase. You can also receive an additional SMS for your number for the selected service (no extra charge for receiving one more SMS). To quickly find the service you need, you can use the convenient search — just type the name of the service you need and get a number for activation. Available payment methods: cryptocurrencies, bank cards, and balance transfer from our other bots. Thank you for your trust! Active links: Virtual Number Service: Go Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store through Telegram messenger. Telegram Bot for purchasing Telegram Stars: Go – fast and profitable purchase of stars in Telegram. SMM Panel: Go – promotion of your social media accounts. We would like to present to you the current list of promotions and special offers for purchasing goods and services from our platform: 1. Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, Bot) during October! You can also use the promo code for your first purchase: SOCNET (15% discount) 2. Get $1 credited to your store balance or a 10–20% discount — simply post your username after registration on our website using the following format: "SEND ME BONUS, MY USERNAME IS..." — post it in our forum thread! 3. Get $1 for your first SMM Panel trial — just open a ticket titled “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our Stars purchasing bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Dear friends, we are pleased to announce great news — we are launching our new bot for purchasing and renting virtual numbers for receiving SMS from any services! Are you tired of reused or resold numbers from other platforms? Try our solution! Our service allows you to receive SMS from any major popular services. The list includes more than 200 services! SMS receiving country: USA (+1). Real physical US numbers are used — never previously used on other platforms! Currently, only short-term rental is available. The rental duration for each phone number is shown when purchasing. The cost of each number is also shown next to the service before purchase. You can also receive an additional SMS for your number for the selected service (no extra charge for receiving one more SMS). To quickly find the service you need, you can use the convenient search — just type the name of the service you need and get a number for activation. Available payment methods: cryptocurrencies, bank cards, and balance transfer from our other bots. Thank you for your trust! Active links: Virtual Number Service: Go Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store through Telegram messenger. Telegram Bot for purchasing Telegram Stars: Go – fast and profitable purchase of stars in Telegram. SMM Panel: Go – promotion of your social media accounts. We would like to present to you the current list of promotions and special offers for purchasing goods and services from our platform: 1. Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, Bot) during October! You can also use the promo code for your first purchase: SOCNET (15% discount) 2. Get $1 credited to your store balance or a 10–20% discount — simply post your username after registration on our website using the following format: "SEND ME BONUS, MY USERNAME IS..." — post it in our forum thread! 3. Get $1 for your first SMM Panel trial — just open a ticket titled “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our Stars purchasing bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • 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