Jump to content
  • 0

PSaxnw code gia mass reward me ip


Question

Recommended Posts

  • 0
Posted

Δεν νομίζω πως είναι τόσο δύσκολο να το καταλάβεις σου έδωσε καθαρά την λύση ο anarchy

 

axaxaxaxaxxaa ok a8ou to les se parakalwww!! kanto mou gia mena mia edw asap :)
  • 0
Posted

/* 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
Posted

/* 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 ;)

Guest
This topic is now closed to further replies.


×
×
  • 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