Łighto™ Posted February 22, 2010 Posted February 22, 2010 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); } }
Devil22 Posted February 22, 2010 Posted February 22, 2010 what is this eh? make a diff. anyway thanks.
Versus Posted February 22, 2010 Posted February 22, 2010 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.
xAddytzu Posted February 22, 2010 Posted February 22, 2010 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
RammS Posted February 23, 2010 Posted February 23, 2010 pff ,its already done by l2j team. just get the last rev of l2jserver gz for the copy / paste
Theonegandalf Posted February 23, 2010 Posted February 23, 2010 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 :)
RammS Posted February 23, 2010 Posted February 23, 2010 stop with the fucking instults pussy kid. bla bla bla.. getlost
Belzebul Posted February 23, 2010 Posted February 23, 2010 instults sry for being an outsider in your fight, but dude learn some english before you try to flame some1
`Rοmeο Posted February 23, 2010 Posted February 23, 2010 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
Matim Posted February 23, 2010 Posted February 23, 2010 what is this eh? make a diff. anyway thanks. You need diff for new class? loled
Versus Posted February 23, 2010 Posted February 23, 2010 http://www.maxcheaters.com/forum/index.php?topic=126391.0;msg=884695 locked
Recommended Posts