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.


  • Posts

    • ??? error   https://ibb.co/Srn4LsX
    • I also think this feature would bring more harm than good... another example is a dwarf rushing against your mobs so he takes priority, then he plays fake death and proceeds to grief the shit out of you. A minimum damage threshold is necessary, which would basically converge to what is the default feature (i.e. biggest damage dealer)
    • I bought the premium to watch the video and it's private. 😢
    • For some Majestic reason OP can't edit their topics anymore?    Let me update the potential offers, I got up to 2 spots to fill.   CONTACT TELEGRAM ONLY: https://t.me/asupport_g1     A credible team that SGuard represents is looking for java developers.    These positions is full time only i.e. your time is mostly dedicated within the team and team tasks, side gigs are fine, as long as you are able to combine your gig and main.  All necessary tools are provided.  The team is consistent with > 10 team members and the team is looking to expand to meet various goals. A decent Lineage 2 Essense OR Main (GOD) knowledge is needed.  Experience with l2r/l2p/l2s. mobius is fine too for referrence only. The team is friendly and goal oriented, very active and resourceful.   Requirements are standard, java knowledge is optional.  Multi language is a plus but not necessary (English/Russian), any is accepted.   Terms and conditions including compensation are reasonable and considered to be up for the industry standards. Details are negotiable with suitable candidates.   You will need to have a headset and a mic just for the initial processing, there're no team meetings or conferences after that. There's a small 30min interview process to demonstrate knowledge and just to meet each other.   The team has decided it is in their best interest to not publish their information at this time. Details will be available only for suitable candidates.   CONTACT TELEGRAM ONLY: https://t.me/asupport_g1
    • Thanks for the detailed info. I also have some ideas in mind but the execution may be hard. Thanks again!
  • Topics

×
×
  • Create New...