Secret Experience

Secret Experience (https://secretexperience.net/)
-   [Lineage] Java Mods (https://secretexperience.net/lineage-java-mods/)
-   -   [L2JServer] Vip Teleport por Cordenadas (https://secretexperience.net/lineage-java-mods/21940-vip-teleport-por-cordenadas.html)

Daniel2 31-05-2010 09:58 PM

Vip Teleport por Cordenadas
 
Bom esse script tem aqui em um servidor da rev do l2 ouro
Nao sei quem fez entao sem creditos

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

Bom primeiro
copie o codigo abaixo cole em um bloco de notas e salve como o nome de: VIPTeleport.java

(salve no local gameserver\data\scripts\handlers\voicedcommandhand lers)


Código:

/*
* 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/>.
*            else if (SiegeManager.getInstance().getSieges() != null)
*            {
*                activeChar.sendMessage("You are in siege!");
*                return false;
*            }
*/

package handlers.voicedcommandhandlers;

import java.util.NoSuchElementException;
import java.util.StringTokenizer;

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

public class VIPTeleport implements IVoicedCommandHandler
{
    private static final String[] _voicedCommands =
    {
        "teleport"
    };
   
    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String tlp)
    {
        if (command.equalsIgnoreCase("teleport"))
        {
            if (activeChar == null)
            {
                return false;
            }
            else if(activeChar.atEvent)
            {
                activeChar.sendMessage("You are an Event.");
                return false;
            }
            else if(activeChar.isInDuel())
            {
                activeChar.sendMessage("You are on Duel.");
                return false;
            }
            else if(activeChar.isInOlympiadMode())
            {
                activeChar.sendMessage("You are in Olympiad.");
                return false;
            }
            else if(activeChar.isInCombat())
            {
                activeChar.sendMessage("You can't teleport in Combat Mod.");
                return false;
            }
            else if (activeChar.isFestivalParticipant())
            {
                activeChar.sendMessage("You are in a festival.");
                return false;
            }
            else if (activeChar.isInJail())
            {
                activeChar.sendMessage("You are in Jail.");
                return false;
            }
            else if (activeChar.inObserverMode())
            {
                activeChar.sendMessage("You are in Observ Mode.");
                return false;
            }
            else if (activeChar.isDead())
            {
                activeChar.sendMessage("You Dead. Can't Teleport.");
                return false;
            }
            else if (activeChar.isFakeDeath())
            {
                activeChar.sendMessage("You are Dead? week up :D");
                return false;
            }
            else if (activeChar.getKarma() > 0)
            {
                activeChar.sendMessage("You can't use teleport command when you have karma.");
                return false;
            }
            else if (activeChar.getAccessLevel().getLevel() != 3)
            {
                activeChar.sendMessage("You Need Account VIP To Use This.");
                return false;
            }
            if(tlp != null)
            {
                teleportTo(activeChar, tlp);
            }
            else
            {
                activeChar.sendMessage("Wrong or no Coordinates given. Usage: /loc to display the coordinates.");
                activeChar.sendMessage("Ex: .teleport <x> <y> <z>");
                return false;
            }
        }
        return true;
    }
   
    private void teleportTo(L2PcInstance activeChar, String Cords)
    {
        try
        {
            StringTokenizer st = new StringTokenizer(Cords);
            String x1 = st.nextToken();
            int x = Integer.parseInt(x1);
            String y1 = st.nextToken();
            int y = Integer.parseInt(y1);
            String z1 = st.nextToken();
            int z = Integer.parseInt(z1);
           
            activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
            activeChar.teleToLocation(x, y, z, false);
           
            activeChar.sendMessage("You have been teleported to " + Cords);
        }
        catch (NoSuchElementException nsee)
        {
            activeChar.sendMessage("Wrong or no Coordinates given. Usage: /loc to display the coordinates.");
            activeChar.sendMessage("Ex: .teleport <x> <y> <z>");
        }
    }
   
    public String[] getVoicedCommandList()
    {
        return _voicedCommands;
    }
}



Apos isso na pasta : scripts\handlers

tem um arquivo chamado (MasterHandler.java)
entre nele e add essa linha

Código:

VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new VIPTeleport());

ATENÇÃO ADD ESSE CODIGO ACIMA APOS A LINHA 222 DO ARQUIVO MasterHandler.java
ficando assim

Código:

linha-222        VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new stats());
linha-223        VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new VIPTeleport());



apos isso incie seu servidor , de acess lvl 3 pra vc e use o comando
.teleport X Y Z

(no X Y Z e as cordenadas do local , pode pega as cordenadas digitando /loc no l2)


ESSE SCRIPT E PRA L2J , SE FOR USA EM OUTRO SERVIDOR COM L2J_EMU , nao se esqueça de altera os import. :GEEK:

{ADM}-Fenex 02-10-2010 03:29 PM

nao tem esi java para interlude nao porque eu jah casei aki esi lugar mais nao acho
gameserver\data\scripts\handlers\voicedcommandhand

Mazokista 03-10-2010 05:25 PM

Esse e So um Exemplo Procure o arquivo
Pra Voce Registrar o Mod basta Ir Nesse Local

L2JStep-Privado\Trunk\L2JStep_CORE\java\com\l2jstep\gamese rver\handler\VoicedCommandHandler.java


Como ele ta Explicando Crie um Arquivo na pasta
L2JStep-Privado\Trunk\L2JStep_CORE\java\com\l2jstep\gamese rver\handler\voicedcommandhandlers\VIPTeleport.java

{ADM}-Fenex 10-10-2010 01:06 PM

no meu ta dando esi erro alguem sabe como arumo ?

[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]

xadresz 10-10-2010 03:48 PM

qual rev você está usando? dependendo da rev, a tabela AccessLevel pode estar diferente, tipo Access_Level etc.. tente ver isto. Não sei se tem algo a ver :cute:

ManoeL-ADM 11-10-2010 04:49 AM

ta faltando um ) pra fexa o elseif na linha com erro ... tente colocar no final dela depois de ... != 3) assim e teste .... veja se funciona e poste!

{ADM}-Fenex 11-10-2010 12:40 PM

@xadresz
não deu com Access_Level

@ManoeL-ADM

também não deu não, eu coloquei a ) no final mais não deu também

Daniel2 20-11-2010 11:55 AM

basta você procurar em config.java que tem aii no seu svn que ele vai dizer qual o modulo que você deve colocar ou você clica duas veses que ele vai te indicar o modulo para você coloca e ficar certo.


Citação:

if (activeChar.getAccessLevel
mano ta certo o interlude geralmente é assim comita e ver oque dar.

JensenAckles 18-01-2012 05:42 PM

Opa. Primeiramente, muito bom o MOD . só o seguinte
eu uso L2JBlack. então ... quando o Player Ganha //setvip o acclevel dele, vai para 3 ? caso não, eu acho que nessa linha que eu terei que modifica certo ?

Código:

f (activeChar.getAccessLevel().getLevel() != 3)
Teria que mudar para o que ?

OliverSykes 18-01-2012 05:46 PM

Eu sou um dos donos do projeto black ele não ganha acess 3 não então significa que não precisa ter esse 3 ai !

JensenAckles 18-01-2012 06:02 PM

Nesse caso, eu posso adicionar o Mod, mas só os Players VIP, vão poder utilizar o comando ? não é preciso modificar mas nada ?

OliverSykes 18-01-2012 06:37 PM

Pode sim mais seria legal enves de mod trabalha com gk igual fazem com npc buffer muito mod corre risco de pesar o pack e buga alguma coisa !


Horários baseados na GMT -3. Agora são 06:48 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0