Jump to content
  • 0

[HELP] Item opens html


Question

Posted

Hello again MxC thanks for your attention...

 

I want your help once more if someone can make a specifique item that opens an html...

 

More detailed I want a usable once item that can't be used on oly, tvt, dead, karma, flagged, fake death,

to open an html...

 

I have found some posts like this one: http://maxcheaters.com/forum/index.php?topic=47545.0

 

But steal not what i want!!! If someone can improve it work for latest l2jserver rev

 

It would be awsome!!!

 

Thanks in advance for reading it!!!

14 answers to this question

Recommended Posts

  • 0
Posted

Its really easy to do.

 

Simply create new item handler for it.

 

You can even c/p restrictions from other item handler or custom share.

 

And few lines of code to open new htm window  (also may be taken from different shares, if u don't know this code)

  • 0
Posted

Simply to open htm window, use this:

 

String html = null;

html = HtmCache.getInstance().getHtm(null, "data/html/filename" + htm);

 

NpcHtmlMessage msg = new NpcHtmlMessage(getObjectId());

msg.setHtml(html);

msg.replace("%objectId%", String.valueOf(getObjectId()));

player.sendPacket(msg);

  • 0
Posted

Open an html with the above as i said... i want just the java thing i can create all the other files...

 

Thanks for your help guys!!!

  • 0
Posted

Oh right, u expect ready code without any own effort?

 

Wrong section, its not martketplace where you can request ready things.

 

Its request dev help, we can post some advices, some tips etc.

 

I gave you code to open html, told you to create item handler.

 

Nothing more to do, just use your brain and put some own effort to do it, and.. done!

  • 0
Posted

Sorry i didn't request the hole code just a little help

 

This code you gave me goes to HtmCache i think sorry i'm kind of newbie in java yet

 

I already created the item handler but the item still not working...

 

I registered it on masterhandler also...

 

and still nothing what else can i do?

 

Does anybody knows the code for the restriction or a part of it i can continue it from there!!!

 

Hmm, open a html with what options? Just a simple html, no buttons(with bypasses i mean)?

 

Nothing just open the html!!! with the restrictions!!!

  • 0
Posted

Show us your code, we will check it and we will provide support for it.

 

About those check, they are really simple, sample:

 

if (player.getKarma > 0)

{

    player.sendMessage("Players with karma are not allowed to use this command!"

    return false;

}

 

Should be simple for everyone, even beginers.

  • 0
Posted

package handlers.itemhandlers;

import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.handler.IItemHandler;
import com.l2jserver.gameserver.model.L2ItemInstance;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;



public class item implements IItemHandler
{
private static final int[] ITEM_IDS = { 10639 };

public void useItem(L2Playable playable, L2ItemInstance item,boolean forceUse)
    {
      if (!(playable instanceof L2PcInstance))
         return;
      L2PcInstance activeChar = (L2PcInstance)playable;
       int itemId = item.getItemId();
      
   if (itemId == 10639)
       {
	String htmFile = "data/html/merchant/658.htm";
	String htmContent = HtmCache.getInstance().getHtm(htmFile);

		NpcHtmlMessage infoHtml = new NpcHtmlMessage(1);
		infoHtml.setHtml(htmContent);
		activeChar.sendPacket(infoHtml);
       }
    }




    public int[] getItemIds()
    {
    	return ITEM_IDS;
    }
}

 

This is the code i used...I dont get any problems on gameserver...

I ju

  • 0
Posted

What do you mean? You don't have to modify anything with item, simply register item handler for item and thats all.

 

Item handlers means only action after double click.

  • 0
Posted

Any error/info logs available at gameserver while loading handlers or trying to double click this item?

 

Make sure item id is correct etc.

 

About name of the class, type name is discouraged. By convention, Java type names usually start with an uppercase letter

  • 0
Posted

Absolutely no errors...Yeah i saw that with the name and fixed it on my code i just forgot to fix it here also...

 

When i just dooble click the item nothing happens and the item id is ok!!!

 

Anyway i will keep trying fixing it if i find the solution will post it here!!!

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

    • You think you have good “l2j” files until you try running a low-rate server.   Saying “there’s not a single L2 server out there worth mentioning” just shows you probably only know the first 10 servers on voting sites, the same voting sites that owned by them. You call the forum dead, yet you’re here discussing your next projects… From my perspective, you don’t seem ready to run any L2 server in 2025. Around 70% of players are here for RMT or ask for payment just to bring their clan, and you really think the community cares about Premium or donations or files quality? The other 20% spend their time downloading and deleting servers all day, playing for one day, then quitting for whatever random reason. And finally, the last 10% are the only ones who actually play because they genuinely like your features, your server files, and your overall project. Good luck 🙂
    • I genuinely admire your bravery - in an age where AI can whip up something better in under a minute, you still stubbornly try to sell these "projects" of yours on a forum that’s been clinically dead for years. That’s no longer determination, that’s digital archaeology. I just can’t tell whether you’re actually trying to make money, or simply testing how much we can endure before we ask an AI to generate you some actual talent.   And ofc AI will make it for free, $220 saved.
    • I’m glad I’m not the only one who appreciates Maxthor’s involvement in group gay orgies, he can’t be bothered to reply to messages, but covering the entire forum in gay lights is absolutely no issue for him. As for the project - the forum is packed with feedback from the testers, the lads are spending every spare moment fixing even the tiniest typo in an NPC’s text. I’ll share the links as soon as I get the green light. Edit: I forgot to add that the GM recruitment will begin once the links are released. Three people will be accepted, and they’ll work in a three-shift rotation so that there’s always a GM available online.
    • Added: a brand-new default dashboard template. You can now add multiple game/login server builds. Full support for running both PTS & L2J servers simultaneously, with switching between them. Payment systems: added OmegaPay and Pally (new PayPal-style API). Account history now stores everything: donations, items delivered to characters, referrals, transfers between game accounts, and coin transfers to another master account. Personal Promo Code System: you can create a promo code and assign it to a user or promoter. When donating, a player can enter this promo code to receive bonus coins, and the promo code owner also receives a bonus — all fully configurable in the admin panel.     Look demo site: demo
    • One of best project i play last few years
  • 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