Jump to content
  • 0

Itemhandler Command


Question

10 answers to this question

Recommended Posts

  • 0
Posted (edited)
5 hours ago, cyta5 said:

Hello i want to make an item when i click on it to open .gmshop command maybe someone can help me to create it ?

 

6 minutes ago, cyta5 said:

I want to write the command ... when I click it 

So you want to create a command , then create an item and when you click the item you will have to type the command inside the html box?

Why would you want to do that? You are basically tripping yourself for no reason.

Edited by protoftw
  • 0
Posted (edited)

I want one item when I click on it to write the command  .gmshop i want to make that beacuse i have some checkers for example %timeremaining% that's show you how much left to buy the special offer again and at the normal html I see the text %timeremaining% instead the time left....

Edited by cyta5
  • 0
Posted (edited)
9 minutes ago, cyta5 said:

I want one item when I click on it to write the command  .gmshop 

It really sounds nonsense to me. You surely need core-edit to do it. If you wanna do that just for that 1 command then it's not worth it for me. You can try creating an item and when you click on it you can have a combo box for players to select their desired option and confirm it. You can also have your type box but then you will have to explain to your players what they should type in and it's a little confusing if I'm being honest with you..Try creating something simple and as easy as possible.A single clickable item is enough.

 

**

9 minutes ago, cyta5 said:

I want one item when I click on it to write the command  .gmshop i want to make that beacuse i have some checkers for example %timeremaining% that's show you how much left to buy the special offer again and at the normal html I see the text %timeremaining% instead the time left....

You see that because there's something wrong from your side, whether on your html or you haven't implemented it on your code.

Edited by protoftw
  • 0
Posted (edited)

Try this one

 

package com.l2jfrozen.gameserver.handler.itemhandlers;

import com.l2jfrozen.gameserver.handler.IItemHandler;
import com.l2jfrozen.gameserver.handler.VoicedCommandHandler;
import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;

public class YourClassName implements IItemHandler
{
	private static final int[] ITEM_IDS =
	{
		// your item id here
	};
	private static final String command = "menu"; //change with your command

	@Override
	public void useItem(final L2PlayableInstance playable, final L2ItemInstance item)
	{
		if (!(playable instanceof L2PcInstance))
			return;
		L2PcInstance activeChar = (L2PcInstance) playable;
		VoicedCommandHandler.getInstance().getVoicedCommandHandler(command).useVoicedCommand(command, activeChar, "");
		activeChar.sendMessage("if you want any message.");
	}

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

 

 

P.s -> You didnt want to write a command. You wanted to call a command :P

Edited by melron
  • 0
Posted

Just lel. Calling an command via item, bcs why not. 

 

Ps: drop the command and move content to that handler. Otherwise item is a total bullshit as ppl can use the command - if they know it. 

Guest
This topic is now closed to further replies.


×
×
  • Create New...