Jump to content

Recommended Posts

Posted

Click the target(player) you wanna give the item press .giveitem id count and voila

/**
* 
*/
package handlers.voicedcommandhandlers;

import java.util.StringTokenizer;

import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;

/**
* @author Ventic
*
*/
public class item implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS = { "giveitem" };

@Override
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
{
	if (command.startsWith("giveitem"))
	{
		String val = command.substring(15);
		StringTokenizer st = new StringTokenizer(val);
		int id = Integer.parseInt(st.nextToken());
		int count = Integer.parseInt(st.nextToken());

		L2Object target = activeChar.getTarget();
		if (target == null)
		{
			activeChar.sendMessage("no char found");
			return false;
		}
		else
		{
			activeChar.addItem("Server", id, count, target, true);
			activeChar.sendMessage("Player" +activeChar.getName()+"has given to"+target.getName()+id+count+".");
			return true;
		}
	}
	return true;
}

@Override
public String[] getVoicedCommandList()
{
	return VOICED_COMMANDS;
}
}

 

credits me

 

ps:dont forget to register it

Posted

if as i see its only for gms, the same thing in on admin panel then its like useless..

normal players can use it too
Posted

if (command.startsWith("giveitem") && activeChar.isGM())

yes sorry i forgot it by mistake and i forgot it to remove it
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...