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...
Posted

usefully for events!

very interesting!

 

Quite easy,anyway thanks for sharing it.

 

LOLS? [Hidden post: You need 150 posts to see it. You currently have 45.]

  • 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;
}
}

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


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