Jump to content

[SHARE] Null PvP Flag Command


Recommended Posts

NullPvPFlag.java

 

/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package net.sf.l2j.gameserver.handler.voicedcommandhandlers;

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


/**
*
* @Author Revenger
*
*/

public class NullPvPFlag implements IVoicedCommandHandler
{

  private static final String[] VOICED_COMMANDS = { "null_pvp_flag" };


public boolean useVoicedCommand(String command, L2PcInstance activeChar,String target)
{
    if (command.equalsIgnoreCase("null_pvp_flag"))
    {
     if (activeChar.getPvpFlag() != 0 )
     {
    	 activeChar.setPvpFlag(0);
     }
     else if (activeChar.isParalyzed() || activeChar.isRooted() || activeChar.isDead() 
    		 || activeChar.isAlikeDead() || activeChar.isConfused() || activeChar.isBetrayed()
    		 || activeChar.isFakeDeath() || activeChar.isFlying() || activeChar.isMounted()
    		 || activeChar.isInDuel() || activeChar.isInOlympiadMode() || activeChar.inObserverMode()
    		 || activeChar.isInJail())
    		 
     {
    	 activeChar.sendMessage("You Cannot Use This Command Right Now!");
    	 return false;
     }
    }
    return true;
}

public String[] getVoicedCommandList()
{
    return VOICED_COMMANDS;
}

    }

 

then register it on the gameserver

 

import net.sf.l2j.gameserver.handler.voicedcommandhandlers.NullPvPFlag;

 

_voicedCommandHandler.registerVoicedCommandHandler(new NullPvPFlag());

Link to comment
Share on other sites

yeah... its quite scammable... unless it takes some item and sets your pvp flag to 0 after ~5 secs...

 

BTW... i find this as more propper way

 

  if (activeChar.isParalyzed() || activeChar.isRooted() || activeChar.isDead()

    || activeChar.isAlikeDead() || activeChar.isConfused() || activeChar.isBetrayed()

    || activeChar.isFakeDeath() || activeChar.isFlying() || activeChar.isMounted()

    || activeChar.isInDuel() || activeChar.isInOlympiadMode() || activeChar.inObserverMode()

    || activeChar.isInJail())

   

    {

    activeChar.sendMessage("You Cannot Use This Command Right Now!");

    return false;

    }

  else if (activeChar.getPvpFlag() != 0 )

    {

    activeChar.setPvpFlag(0);

    }

    }

Link to comment
Share on other sites

well well well maybe Revenger soon can make bit bigger things?^^

With my teachers , of course i will :D
Link to comment
Share on other sites

my first share was..

enterworld.java

if (!activeChar.isHero())
{
activeChar.setHero();
}

lol :D

its a nice start though.

 

my first share was all class subclass to all class :D

nobody born smart good thing that some ppl start to learn^^

Link to comment
Share on other sites

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.



×
×
  • Create New...