Jump to content

Recommended Posts

Posted

//sit - click target and player you target will sit down

//stand - click target and player you target will stand up

//rangesit - players in 240 radius will sit down

//rangestand - players in 240 radius will stand up

 

/**
* 
*/
package handlers.admincommandhandlers;

import java.util.Collection;

import com.l2jserver.gameserver.handler.IAdminCommandHandler;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;

/**
* @author Ventic
*
*/
public class AdminSit implements IAdminCommandHandler
{
private static final String[] ADMIN_COMMANDS = { "sit" , "stand", "rangesit", "rangestand" };

@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
	if (command.startsWith("sit"))
	{
		L2Object target = activeChar.getTarget();
		if (target == null)
		{
			activeChar.sendMessage("No target found");
			return false;
		}
		else
		{
				((L2PcInstance) target).sitDown();
		}
		if (command.startsWith("stand"))
		{
			L2Object targetPc = activeChar.getTarget();
			if (targetPc == null)
			{
				activeChar.sendMessage("No target found");
				return false;
			}
			else
			{
					((L2PcInstance) targetPc).standUp();
			}
		}
		if (command.startsWith("rangesit"))
		{
			Collection<L2Character> players = activeChar.getKnownList().getKnownCharactersInRadius(240);

			for (L2Character p : players)
			{
				if (p instanceof L2PcInstance)
				{
					((L2PcInstance) p).sitDown();
				}
				else
				{
					if (p == null)
					{
						activeChar.sendMessage("No players found so close");
						return false;
					}
				}
			}
		}
		if (command.startsWith("rangestand"))
		{
			Collection <L2Character> playersPc = activeChar.getKnownList().getKnownCharactersInRadius(240);

			for (L2Character pPc : playersPc)
			{
				if (pPc instanceof L2PcInstance)
				{
					((L2PcInstance) pPc).standUp();
				}
				else
				{
					if (pPc == null)
					{
						activeChar.sendMessage("No players found so close");
						return false;
					}
				}
			}

		}
	}
	return true;
}

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

 

Idea Dialogos

Credits,coded by me

 

ps:dont forget to register it

Posted

One question[no reason], you have coded in Hi5 or freya l2j? Because i see the com.l2jserver

epilogue but really it doesnt matter
  • 1 month later...
  • 1 year later...
Posted

the code is not working... thats the real code

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

import java.util.Collection;

import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.model.L2Character;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;

/**
* @author Ventic
*
*/
public class AdminSit implements IAdminCommandHandler
{
private static final String[] ADMIN_COMMANDS = { "admin_sit" , "admin_stand", "admin_rangesit", "admin_rangestand" };

@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
	if (command.startsWith("admin_sit"))
	{
		L2Object target = activeChar.getTarget();
		if (target instanceof L2NpcInstance)
		{
		   activeChar.sendMessage("You can not use it at NPCs!");
               return false;
		}
            else if (target == null)
		{
			activeChar.sendMessage("You have no target!");
            return false;
		}
		else
		{
			((L2PcInstance) target).sitDown();
		}
	}

	if (command.startsWith("admin_stand"))
	{
		L2Object target = activeChar.getTarget();
		if (target instanceof L2NpcInstance)
		{
		   activeChar.sendMessage("You can not use it at NPCs!");
               return false;
		}
            else if (target == null)
		{
			activeChar.sendMessage("You have no target!");
            return false;
		}
		else
		{
			((L2PcInstance) target).standUp();
		}
	}

	if (command.startsWith("admin_rangesit"))
	{
		Collection<L2Character> players = activeChar.getKnownList().getKnownCharactersInRadius(240);
		for (L2Character p : players)
		{
			if (p instanceof L2PcInstance)
			{
				((L2PcInstance) p).sitDown();
			}
		}
	}

	if (command.startsWith("admin_rangestand"))
	{
		Collection <L2Character> players = activeChar.getKnownList().getKnownCharactersInRadius(240);
		for (L2Character p : players)
		{
			if (p instanceof L2PcInstance)
			{
				((L2PcInstance) p).standUp();
			}
		}

	}
return true;

}

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Hello, I'm looking for classic client for l2 gold or l2 gold weapons for classic 166 version
    • Good afternoon   ⚡CAN'T GO TO THE ONLINE STORE? OPEN THE SITE VIA VPN OR TOR BROWSER⚡ ⚡PREMIUM QUALITY ACCOUNTS, INSTANT DELIVERY, FREE CONSULTATIONS, RELIABLE WORK⚡   ✔ Ready accounts ✔   BUSINESS ACCOUNTS ☟ Blackcatcard Business LV, Volet com (AdvCash) Business EU, Xapo Bank Business EU, Finom Business, PayPal Business, Payset Business, Stripe Business, Payoneer Business EU, Wise Business UK/EU, Revolut Business EU/UK, N26 Business DE, Wallester Business EU, Mistertango Business LV   BANKS, NATIONAL BANKS ☟ Ceska Sporitelna, KASIKORNBANK, BBVA, CommerzBank, Santander, Kaspi Bank, AlfaBank, Raiffeisen, mBank, Paribas, Bereke Bank, Freedom Bank   PAYMENT SYSTEMS ☟ Bunq on emulator (DE, NL, FR, ES, IE ibans), Revolut on emulator (UK/EU), ICard, BlackCatCard, Vivid DE, Bankera, Bitsa, Wise EU/UK, N26 DE on emulator, Skrill, Neteller, Trasta, Wirex, Lama, Paysera, 4x4 io, Weststein, Paysafecard, Paysend, Genome, Conotoxia, Mybrocard, Payz Silver, Pockit UK, NagaPay, Volet com, SpectroCoin, SwissMoney, Yuh, Lydia / Sumeria, Ka.App, Wittix, Western Union, MyGuava   CRYPTOEXCHANGE ☟ Poloniex, Bitmart, Kraken, WhiteBit, Quppy, Nexo, Gate, OKX, Paybis, Paxful, Huobi (HTX), xcoins com, Bit2Me, Bybit LVL 2, KuCoin, Binance LVL 2, Mexc, Latoken   Contact via telegram - in the first post of the topic!
    • Sell "Amoral" Classic Armor and Weapon.   Custom "Amoral" Draconic Set YouTube Custom "Amoral" Imperial Set YouTube Custom "Amoral" Dark Crystal Robe YouTube Custom "Amoral" Classic S-Grade Weapon YouTube My Contacts Telegram  
    • Greetings to all! I offer a scope for client modification. What services do I provide: 1) Transfer of any Weapon, Armor, Accessories, from any chronicles to yours. 2) Creating exclusive add-ons. 3) Repainting of Armor, Weapons аnd Accessories. 4) Packing the icons you need and other things. 5) Creating NPCs with and without effects. 6) Create Monsters and Raid bosses, with effects and sounds. 7) HTLM NPC design. Creating Buttons and other things for your project. And much more If you have any questions, write in  Telegram. You can find some of the works here  YouTube
  • Topics

×
×
  • Create New...