Jump to content

[Share] Admin award all players


Recommended Posts

Hello people.

 

Since i helped a guy here  "http://www.maxcheaters.com/forum/index.php?topic=126391.0" with the same issue, i decided to share

the admin command //mass_create. How it works? You type //mass_create itemID amount (e.g //mass_create 57 1 -> This will add 1 adena to every online player)

 

Tested in L2J Interlude and works fine.

 

package net.sf.l2j.gameserver.handler.admincommandhandlers;

import java.util.StringTokenizer;

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.datatables.ItemTable;
import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
import net.sf.l2j.gameserver.model.GMAudit;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.serverpackets.ItemList;
import net.sf.l2j.gameserver.templates.L2Item;



public class AdminMassCreate implements IAdminCommandHandler {
private static final String[] ADMIN_COMMANDS = { "admin_mass_create" };
private static final int REQUIRED_LEVEL = Config.GM_CREATE_ITEM; // you need the same access level as create_item.

public boolean useAdminCommand(String command, L2PcInstance activeChar) {
	if (!Config.ALT_PRIVILEGES_ADMIN) {
		if (!(checkLevel(activeChar.getAccessLevel()) && activeChar.isGM()))
			return false;
	}

	GMAudit.auditGMAction(activeChar.getName(), command, (activeChar.getTarget() != null?activeChar.getTarget().getName():"no-target"), "");

	if (command.startsWith("admin_mass_create")) {
		try {
			String val = command.substring(17);
			StringTokenizer st = new StringTokenizer(val);
			if (st.countTokens() == 2) {
				String id = st.nextToken();
				int idval = Integer.parseInt(id);
				String num = st.nextToken();
				int numval = Integer.parseInt(num);
				massCreate(activeChar, idval, numval);
			} else if (st.countTokens() == 1) {
				String id = st.nextToken();
				int idval = Integer.parseInt(id);
				massCreate(activeChar, idval, 1);
			}
		} catch (StringIndexOutOfBoundsException e) {
			activeChar.sendMessage("Usage: //itemcreate <itemId> [amount]");
		} catch (NumberFormatException nfe) {
			activeChar.sendMessage("Specify a valid number.");
		}
	}
	return true;
}

private void massCreate(L2PcInstance activeChar, int idval, int numval) {
	for (L2PcInstance _players : L2World.getInstance().getAllPlayers()) {
		if (_players == activeChar)
			continue;

		_players.getInventory().addItem("Admin", idval, numval, _players,
				null);

		ItemList il = new ItemList(_players, true);
		_players.sendPacket(il);
		_players.sendMessage("Admin award you " + numval
				+ " item(s) number " + idval);

		activeChar.sendMessage("You have spawned " + numval
				+ " item(s) number " + idval + " in all chars inventory.");
	}

}

public String[] getAdminCommandList() {
	return ADMIN_COMMANDS;
}

private boolean checkLevel(int level) {
	return (level >= REQUIRED_LEVEL);
}
}

 

 

Link to comment
Share on other sites

its not your work ...

its shared by down !

 

Please give me a link or something so i can know if i'll lock this topic or not.

Link to comment
Share on other sites

Hello people.

 

Since i helped a guy here  "http://www.maxcheaters.com/forum/index.php?topic=126391.0" with the same issue, i decided to share

the admin command //mass_create. How it works? You type //mass_create itemID amount (e.g //mass_create 57 1 -> This will add 1 adena to every online player)

 

Tested in L2J Interlude and works fine.

 

package net.sf.l2j.gameserver.handler.admincommandhandlers;

 

import java.util.StringTokenizer;

 

import net.sf.l2j.Config;

import net.sf.l2j.gameserver.datatables.ItemTable;

import net.sf.l2j.gameserver.handler.IAdminCommandHandler;

import net.sf.l2j.gameserver.model.GMAudit;

import net.sf.l2j.gameserver.model.L2World;

import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

import net.sf.l2j.gameserver.serverpackets.ItemList;

import net.sf.l2j.gameserver.templates.L2Item;

 

 

 

public class AdminMassCreate implements IAdminCommandHandler {

private static final String[] ADMIN_COMMANDS = { "admin_mass_create" };

private static final int REQUIRED_LEVEL = Config.GM_CREATE_ITEM; // you need the same access level as create_item.

 

public boolean useAdminCommand(String command, L2PcInstance activeChar) {

if (!Config.ALT_PRIVILEGES_ADMIN) {

if (!(checkLevel(activeChar.getAccessLevel()) && activeChar.isGM()))

return false;

}

 

GMAudit.auditGMAction(activeChar.getName(), command, (activeChar.getTarget() != null?activeChar.getTarget().getName():"no-target"), "");

 

if (command.startsWith("admin_mass_create")) {

try {

String val = command.substring(17);

StringTokenizer st = new StringTokenizer(val);

if (st.countTokens() == 2) {

String id = st.nextToken();

int idval = Integer.parseInt(id);

String num = st.nextToken();

int numval = Integer.parseInt(num);

massCreate(activeChar, idval, numval);

} else if (st.countTokens() == 1) {

String id = st.nextToken();

int idval = Integer.parseInt(id);

massCreate(activeChar, idval, 1);

}

} catch (StringIndexOutOfBoundsException e) {

activeChar.sendMessage("Usage: //itemcreate <itemId> [amount]");

} catch (NumberFormatException nfe) {

activeChar.sendMessage("Specify a valid number.");

}

}

return true;

}

 

private void massCreate(L2PcInstance activeChar, int idval, int numval) {

for (L2PcInstance _players : L2World.getInstance().getAllPlayers()) {

if (_players == activeChar)

continue;

 

_players.getInventory().addItem("Admin", idval, numval, _players,

null);

 

ItemList il = new ItemList(_players, true);

_players.sendPacket(il);

_players.sendMessage("Admin award you " + numval

+ " item(s) number " + idval);

 

activeChar.sendMessage("You have spawned " + numval

+ " item(s) number " + idval + " in all chars inventory.");

}

 

}

 

public String[] getAdminCommandList() {

return ADMIN_COMMANDS;

}

 

private boolean checkLevel(int level) {

return (level >= REQUIRED_LEVEL);

}

}

 

 

 

 

Fail

Link to comment
Share on other sites

Well, are you stupid or something ? Lighto helped a guy in this topic and he just shared the full code here so anyone can use it! he didn't say, WHOA IT IS UNIQUE, YOU CAN'T FIND IT ANYWHERE!

 

 

Here is the link with the guy he helped http://www.maxcheaters.com/forum/index.php?topic=126391.0"

 

You people seriously are soo dumb. Before you post something, think. It isn't difficult nor painfull. Really :)

Link to comment
Share on other sites

Please give me a link or something so i can know if i'll lock this topic or not.

 

http://www.maxcheaters.com/forum/index.php?topic=126391.0;msg=884695

Link to comment
Share on other sites

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