Jump to content
  • 0

Admin command problem


Question

Posted (edited)

Im using this code (https://pastebin.com/MvUQ6NNv) to show player inventory and delete selected item.

it should have an [X] icon next to the item and  when clicked it would delete but it doesnt appear. also it lists all the items in 1 page and not in defferent pages. when i click on the page No. it just refreshes the command.. 

 

getting this error  when i mannually try the delete command :  

Exception during execution of admin_delete_item
java.lang.StringIndexOutOfBoundsException: begin 18, end 17, length 17

 

inventory.png.12dedded8b93b25931cd8abef476ee24.png

 

 

it should be like this:

779399164_invworking.png.eb056c5463898ebbd4609cc215c284e1.png

Edited by Drazeal

4 answers to this question

Recommended Posts

  • 0
Posted
26 minutes ago, Drazeal said:

Im using this code (https://pastebin.com/MvUQ6NNv) to show player inventory and delete selected item.

it should have an [X] icon next to the item and  when clicked it would delete but it doesnt appear. also it lists all the items in 1 page and not in defferent pages. when i click on the page No. it just refreshes the command.. 

 

getting this error  when i mannually try the delete command :  

Exception during execution of admin_delete_item
java.lang.StringIndexOutOfBoundsException: begin 18, end 17, length 17

 

Your problem is in this line: 

 

String val = command.substring(ADMIN_COMMANDS[1].length() + 1);

 

Java basically is trying to substring the current String using bigger length than the String's length.

The way it tries to retrieve the id of the selected item afterwards it's ancient so instead you can use

StringTokenizer.

 

The way to use it is the following: 

 

final StringTokenizer st = new StringTokenizer(command);
st.nextToken(); // Unused since it's the admin's command

final int itemId = Integer.parseInt(st.nextToken());

 

Consider the code is written by hand. I just want to give you the idea.

 

  • 0
Posted (edited)
3 hours ago, Kara said:

 

Your problem is in this line: 

 




String val = command.substring(ADMIN_COMMANDS[1].length() + 1);

 

Java basically is trying to substring the current String using bigger length than the String's length.

The way it tries to retrieve the id of the selected item afterwards it's ancient so instead you can use

StringTokenizer.

 

The way to use it is the following: 

 




final StringTokenizer st = new StringTokenizer(command);
st.nextToken(); // Unused since it's the admin's command

final int itemId = Integer.parseInt(st.nextToken());

 

Consider the code is written by hand. I just want to give you the idea.

 

I managed to fix the error but i cant make the [X] to appear so that i can execute the command and delete the selected item.

Edited by Drazeal
  • 0
Posted
On 2/21/2021 at 5:59 PM, Drazeal said:

I managed to fix the error but i cant make the [X] to appear so that i can execute the command and delete the selected item.

 

I can't see the html problem. Maybe replace the:

 

sbItems.append("<td><button action=\"bypass -h admin_delete_item " + String.valueOf(item.getObjectId()) + "\" width=16 height=16 back=\"L2UI_ct1.Button_DF_Delete\" fore=\"L2UI_ct1.Button_DF_Delete\">" + "</td></tr>");

 

with:

 

sbItems.append("<td><button value=\"\" action=\"bypass -h admin_delete_item " + String.valueOf(item.getObjectId()) + "\" width=16 height=16 back=\"L2UI_ct1.Button_DF_Delete\" fore=\"L2UI_ct1.Button_DF_Delete\"></td></tr>");

 

Just give it a try nothing to lose.

Guest
This topic is now closed to further replies.


  • Posts

    • Γεια σε ολους, προσπαθω εδω και 2 μερες να κανω αυτο το πραγμα να λειτουργει. το καταφερα για ενα διαστημα 5 ωρων. αλλα φαινεται οτι το discord μου κανει block to dll. ή κατι αλλο που δεν μπορω να ειμαι σιγουρος για το τι φταιει... αν καποιος γνωριζει κατι ας στειλει ενα pm να το δουμε μαζι.  *το source το εφιαξα εγω. https://youtu.be/kMvrbo9VBZc  ενα βιντεο που δειχνει πως δουλευε πριν σταματησει να δουλευει...   
    • thank you, please move to the desired category
    • wrong section, you need move this post to https://maxcheaters.com/forum/72-marketplace-l2packs-files/
    • Unlock Unlimited Access with GoProxy's Residential Proxies!   Experience seamless, secure, and unrestricted connectivity worldwide with GoProxy's Unlimited Residential Proxies. Our service offers access to a global network of rotating residential IPs, ensuring top performance for your large-scale data collection, streaming, and more.     ✔️Unlimited Traffic & IPs: Enjoy unrestricted access with our rotating residential proxies, delivering high performance through a vast global IP pool. ✔️High Success Rate: Achieve a 99.96% success rate with a rapid 0.6-second response time, ensuring efficient and reliable operations. ✔️Flexible Sessions: Customize IP rotation to fit your project needs, with options for automatic rotation and sticky sessions lasting up to 60 minutes. ✔️Global Coverage: Access IPs from over 120 countries, making it ideal for businesses requiring high bandwidth without region-specific constraints.     All plans include unlimited traffic and IPs, unlimited concurrent requests, and access to real residential IP addresses. Elevate your online operations with GoProxy's Unlimited Residential Proxies—your smart choice for large-scale projects.   👉 Learn more and get started today: GoProxy Unlimited Proxies
  • Topics

×
×
  • Create New...