Vkouk Posted June 16, 2011 Posted June 16, 2011 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 Quote
vampir Posted June 16, 2011 Posted June 16, 2011 if as i see its only for gms, the same thing in on admin panel then its like useless.. Quote
Vkouk Posted June 16, 2011 Author Posted June 16, 2011 Thank you legollas! :P donr call me legollas Quote
Vkouk Posted June 16, 2011 Author Posted June 16, 2011 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 Quote
vampir Posted June 16, 2011 Posted June 16, 2011 if (command.startsWith("giveitem") && activeChar.isGM()) Quote
Vkouk Posted June 16, 2011 Author Posted June 16, 2011 if (command.startsWith("giveitem") && activeChar.isGM()) yes sorry i forgot it by mistake and i forgot it to remove it Quote
xMrPwN Posted September 5, 2012 Posted September 5, 2012 String index out of range: -7 ? And yes I have tried many id/count combinations Quote
Recommended Posts
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.