JustBeatIt Posted February 27, 2012 Posted February 27, 2012 Gia sas pedia thelw ena code otan kanoume mass reward na pernoun reward an mia ip kai oxi ana char... thanks ;)
0 vl4d Posted March 1, 2012 Posted March 1, 2012 Δεν νομίζω πως είναι τόσο δύσκολο να το καταλάβεις σου έδωσε καθαρά την λύση ο anarchy axaxaxaxaxxaa ok a8ou to les se parakalwww!! kanto mou gia mena mia edw asap :)
0 JustBeatIt Posted March 1, 2012 Author Posted March 1, 2012 den ktlv pws na to kanw :| an eixa ktlv profanos den tha imouna edw !
0 An4rchy Posted March 2, 2012 Posted March 2, 2012 /* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * http://www.gnu.org/copyleft/gpl.html */ package net.sf.l2j.gameserver.handler.admincommandhandlers; import java.util.Collection; import java.util.StringTokenizer; import javolution.util.FastList; import net.sf.l2j.gameserver.datatables.ItemTable; import net.sf.l2j.gameserver.handler.IAdminCommandHandler; import net.sf.l2j.gameserver.model.L2World; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; /** * * @author Anarchy * Gia JustBeatIt */ public class AdminMassReward implements IAdminCommandHandler { private static final String[] ADMIN_COMMANDS = { "admin_massreward" }; private static FastList<String> ips = new FastList<String>(); public boolean useAdminCommand(String command, L2PcInstance activeChar) { if (command.startsWith("admin_massreward")) { String cmd = command.substring(17); StringTokenizer st = new StringTokenizer(cmd); if (st.countTokens() != 2) { activeChar.sendMessage("Usage: //massreward id count."); return false; } int id = Integer.parseInt(st.nextToken()); int count = Integer.parseInt(st.nextToken()); Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values(); for (L2PcInstance p : pls) { String pIp = p.getClient().getConnection().getInetAddress().getHostAddress(); if (!ips.contains(pIp)) { ips.add(pIp); p.addItem("Mass reward.", id, count, p, true); } else { p.sendMessage("This character is a dualbox, so he wasn't rewarded."); } } activeChar.sendMessage("You have rewarded everyone with "+count+" "+ItemTable.getInstance().getTemplate(id).getName()+"."); ips.clear(); } return true; } public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } Prepei na to kaneis kai register sto AdminCommandHandler, etsi: registerAdminCommandHandler(new AdminMassReward()); Elpizw na boithisa.
0 JustBeatIt Posted March 2, 2012 Author Posted March 2, 2012 /* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * http://www.gnu.org/copyleft/gpl.html */ package net.sf.l2j.gameserver.handler.admincommandhandlers; import java.util.Collection; import java.util.StringTokenizer; import javolution.util.FastList; import net.sf.l2j.gameserver.datatables.ItemTable; import net.sf.l2j.gameserver.handler.IAdminCommandHandler; import net.sf.l2j.gameserver.model.L2World; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; /** * * @author Anarchy * Gia JustBeatIt */ public class AdminMassReward implements IAdminCommandHandler { private static final String[] ADMIN_COMMANDS = { "admin_massreward" }; private static FastList<String> ips = new FastList<String>(); public boolean useAdminCommand(String command, L2PcInstance activeChar) { if (command.startsWith("admin_massreward")) { String cmd = command.substring(17); StringTokenizer st = new StringTokenizer(cmd); if (st.countTokens() != 2) { activeChar.sendMessage("Usage: //massreward id count."); return false; } int id = Integer.parseInt(st.nextToken()); int count = Integer.parseInt(st.nextToken()); Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values(); for (L2PcInstance p : pls) { String pIp = p.getClient().getConnection().getInetAddress().getHostAddress(); if (!ips.contains(pIp)) { ips.add(pIp); p.addItem("Mass reward.", id, count, p, true); } else { p.sendMessage("This character is a dualbox, so he wasn't rewarded."); } } activeChar.sendMessage("You have rewarded everyone with "+count+" "+ItemTable.getInstance().getTemplate(id).getName()+"."); ips.clear(); } return true; } public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } Prepei na to kaneis kai register sto AdminCommandHandler, etsi: registerAdminCommandHandler(new AdminMassReward()); Elpizw na boithisa. euxaristw polu file mou!!! kapoios na lock ;)
Question
JustBeatIt
Gia sas pedia thelw ena code otan kanoume mass reward na pernoun reward an mia ip kai oxi ana char... thanks ;)
20 answers to this question
Recommended Posts