Jump to content

[Share].pvp Voice Command


Fanky

Recommended Posts

Hello folks,

Index:net.sf.l2j.gameserver.handlers.[b]voicecommandhandlers[/b]
========================================================
/*
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
*/

package handlers.voicedcommandhandlers;

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

/**
*
*@author Jve
*
*/
public class Pvp implements IVoicedCommandHandler
{
    private static final String[] VOICED_COMMANDS = { "pvp" };

    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
    {   
       
        if (command.equalsIgnoreCase("pvp"))
        {          
             if(activeChar.isInJail())
            {
                activeChar.sendMessage("Sorry, you cant use this command,you are in Jail");
                return false;
            }
            else if(activeChar.isInOlympiadMode())
            {
                activeChar.sendMessage("Sorry,you cant use this command,you are in the Olympiad now");
                return false;
            }
                    
            else if(activeChar.atEvent)
            {
                activeChar.sendMessage("Sorry,you cant use this command,you are in an event");
                return false;
            }
            else  if (activeChar.isInDuel())
            {
                activeChar.sendMessage("Sorry,you cant use this command,you are in a duel");
                return false;
            }
            else if (activeChar.inObserverMode())
            {
               activeChar.sendMessage("Sorry,you cant use this command,you are in the observation.");
               return false;
            }
               
               activeChar.teleToLocation(your X, your y, your Z);
               activeChar.sendMessage("You have been teleported to PvP zone");
        }
        return true;
    }
    public String[] getVoicedCommandList()
    {
        return VOICED_COMMANDS;
    }
}

Index:net.sf.l2j.gameserver.gameserver.Java

==========================================

+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.pvp;

 

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

 

 

_voicedCommandHandler.registerVoicedCommandHandler(new Banking());

 

+_voicedCommandHandler.registerVoicedCommandHandler(new pvp());

 


Note:I did this share according to TheEnd's guide

you just press .pvp and it teleports you to your locations(actually you have to put your pvp locations to be nice),as you can see it has restrictions.

Thats all,

I know its pretty pretty simple to make something like that,but ok someone maybe need it for his server.

 

Link to comment
Share on other sites

http://www.maxcheaters.com/forum/index.php?topic=77872.0

 

And also the code is messed up, because you deleted one of his checks.

So not only you leeched his code, but you even did it in the wrong way.

 

. . . .

Link to comment
Share on other sites

@Coyote:I think he created in his own without seeing that one..

 

Read TheEnd's "sendMessage()" messages, and read his.

Read TheEnd's int values and read his.

 

And last proof, TheEnd included some more stuff in his code. Jve deleted them, so the code does not work as supposed now.

To be more specific:

 

else if (activeChar.inObserverMode())
           {
              activeChar.sendMessage("Sorry,you cant use this command,you are in the observation.");
         
              int placex;
              int placey;
              int placez;
              
              placex = [b]<--Put your PvP Loc area[/b];
              placey = [b]<--Put your PvP Loc area[/b];
              placez = [b]<--Put your PvP Loc area[/b];
              
              activeChar.teleToLocation(placex, placey, placez);
    activeChar.sendMessage("You have been teleported to PvP zone");
       }

 

Do you know what will be the result of this?

Link to comment
Share on other sites

It's a pvp or a teleport command?

 

@Coyote:I think he created in his own without seeing that one..

Its a teleport command,i make as .pvp beacuse you can put your own pvp's location area

press .pvp and it ports you to your location.

@Coyote i dint leach anyone and nothing.

Link to comment
Share on other sites

y i make it according to TheEnd's guide >.>

but i did some edits.

 

Mate, the only thing you edited was the authorship and the name of the code..

You even removed some basic checks and made the code wrong..

Now, the player will be teleported to this PvP Area, only while he is observing the Olympiad..

 

If you really want to practice your Java skills, then start with your own codes.

Even if they are small in size, even if they are useless, you have to know that we all started in this way..

Link to comment
Share on other sites

Mate, the only thing you edited was the authorship and the name of the code..

You even removed some basic checks and made the code wrong..

Now, the player will be teleported to this PvP Area, only while he is observing the Olympiad..

 

If you really want to practice your Java skills, then start with your own codes.

Even if they are small in size, even if they are useless, you have to know that we all started in this way..

ah,yes i know

but actualy i did practise even if you dont bealive i read again and again TheEnd's guide and i did this. :D

Btw i ll do what you told me,be sure for this.

Link to comment
Share on other sites

Replace it with that

Index:net.sf.l2j.gameserver.handlers.[b]voicecommandhandlers[/b]
========================================================
/*
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
*/

package handlers.voicedcommandhandlers;

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

/**
*
*@author Jve
*
*/
public class Pvp implements IVoicedCommandHandler
{
    private static final String[] VOICED_COMMANDS = { "pvp" };

    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
    {   
       
        if (command.equalsIgnoreCase("pvp"))
        {          
             if(activeChar.isInJail())
            {
                activeChar.sendMessage("Sorry, you cant use this command,you are in Jail");
                return false;
            }
            else if(activeChar.isInOlympiadMode())
            {
                activeChar.sendMessage("Sorry,you cant use this command,you are in the Olympiad now");
                return false;
            }
                    
            else if(activeChar.atEvent)
            {
                activeChar.sendMessage("Sorry,you cant use this command,you are in an event");
                return false;
            }
            else  if (activeChar.isInDuel())
            {
                activeChar.sendMessage("Sorry,you cant use this command,you are in a duel");
                return false;
            }
            else if (activeChar.inObserverMode())
            {
               activeChar.sendMessage("Sorry,you cant use this command,you are in the observation.");
               return false;
            }
               
               activeChar.teleToLocation(your X, your y, your Z);
               activeChar.sendMessage("You have been teleported to PvP zone");
        }
        return true;
    }
    public String[] getVoicedCommandList()
    {
        return VOICED_COMMANDS;
    }
}

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