Editted warp command.

Results 1 to 2 of 2
  1. #1
    Account Upgraded | Title Enabled! Halcyon is offline
    MemberRank
    Mar 2011 Join Date
    1,103Posts

    Editted warp command.

    PHP Code:
        public static class Warp extends CommandExecute {

            @
    Override
            
    public int execute(MapleClient cString[] splitted) {
                
    MapleCharacter victim c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
                if (
    victim != null && c.getPlayer().getGMLevel() >= victim.getGMLevel() && !victim.inPVP() && !c.getPlayer().inPVP()) {
                    if (
    splitted.length == 2) {
                        
    c.getPlayer().changeMap(victim.getMap(), victim.getMap().findClosestSpawnpoint(victim.getTruePosition()));
                    } else {
                        
    MapleMap target ChannelServer.getInstance(c.getChannel()).getMapFactory().getMap(Integer.parseInt(splitted[2]));
                        if (
    target == null) {
                            
    c.getPlayer().dropMessage(6"Map does not exist");
                            return 
    0;
                        }
                        
    MaplePortal targetPortal null;
                        if (
    splitted.length 3) {
                            try {
                                
    targetPortal target.getPortal(Integer.parseInt(splitted[3]));
                            } catch (
    IndexOutOfBoundsException e) {
                                
    // noop, assume the gm didn't know how many portals there are
                                
    c.getPlayer().dropMessage(5"Invalid portal selected.");
                            } catch (
    NumberFormatException a) {
                                
    // noop, assume that the gm is drunk
                            
    }
                        }
                        if (
    targetPortal == null) {
                            
    targetPortal target.getPortal(0);
                        }
                        
                    }
                } else {
                    try {
                        
    victim c.getPlayer();
                        
    int ch World.Find.findChannel(splitted[1]);
                        if (
    ch 0) {
                            
    MapleMap target c.getChannelServer().getMapFactory().getMap(Integer.parseInt(splitted[1]));
                            if (
    target == null) {
                                
    c.getPlayer().dropMessage(6"Map does not exist");
                                return 
    0;
                            }
                            
    MaplePortal targetPortal null;
                            if (
    splitted.length 2) {
                                try {
                                    
    targetPortal target.getPortal(Integer.parseInt(splitted[2]));
                                } catch (
    IndexOutOfBoundsException e) {
                                    
    // noop, assume the gm didn't know how many portals there are
                                    
    c.getPlayer().dropMessage(5"Invalid portal selected.");
                                } catch (
    NumberFormatException a) {
                                    
    // noop, assume that the gm is drunk
                                
    }
                            }
                            if (
    targetPortal == null) {
                                
    targetPortal target.getPortal(0);
                            }
                            
    c.getPlayer().changeMap(targettargetPortal);
                        } else {
                            
    victim ChannelServer.getInstance(ch).getPlayerStorage().getCharacterByName(splitted[1]);
                            
    c.getPlayer().dropMessage(6"Cross changing channel. Please wait.");
                            if (
    victim.getMapId() != c.getPlayer().getMapId()) {
                                final 
    MapleMap mapp c.getChannelServer().getMapFactory().getMap(victim.getMapId());
                                
    c.getPlayer().changeMap(mappmapp.findClosestPortal(victim.getTruePosition()));
                            }
                            
    c.getPlayer().changeChannel(ch);
                        }
                    } catch (
    Exception e) {
                        
    c.getPlayer().dropMessage(6"Something went wrong " e.getMessage());
                        return 
    0;
                    }
                }
                return 
    1;
            }
        } 
    I need it so that you can warp to people, and warp to maps, but you cannot warp other people other than yourself to maps. Please help?


  2. #2
    Account Upgraded | Title Enabled! X-Tasis is offline
    MemberRank
    Feb 2009 Join Date
    1,192Posts

    Re: Editted warp command.

    I have a very long time without coding for MapleStory... However, this is what I thinks you need.

    PHP Code:
    public static class Warp extends CommandExecute {

            @
    Override 
            
    public int execute(MapleClient cString[] splitted) {
                if (
    splitted.length 1) {
                    
    String category splitted[1];
                    if (
    category != null) {
                        if (
    category.equals("m")) { //Map
                            
    MapleMap target ChannelServer.getInstance(c.getChannel()).getMapFactory().getMap(Integer.parseInt(splitted[2]));
                            if (
    target != null) {
                                
    MaplePortal targetPortal null
                                if (
    splitted.length 2) {
                                    try {
                                        
    targetPortal target.getPortal(Integer.parseInt(splitted[3]));
                                    } catch (
    Exception e) {
                                        
    c.getPlayer().dropMessage(5"Invalid portal selected.");
                                    }
                                }
                                if (
    targetPortal == null) {
                                    
    targetPortal target.getPortal(0); 
                                }
                            } else {
                                
    c.getPlayer().dropMessage(6"Map ID does not exist."); 
                                return 
    0;
                            }
                        } else if (
    category.equals("p")) { //Player
                            
    String characterName splitted[1];
                            
    int ch World.Find.findChannel(characterName);
                            if (
    ch > -1) {
                                
    victim ChannelServer.getInstance(ch).getPlayerStorage().getCharacterByName(characterName);
                                if (
    victim != null && c.getPlayer().getGMLevel() >= victim.getGMLevel() && !victim.inPVP() && !c.getPlayer().inPVP()) {
                                    
    c.getPlayer().changeMap(victim.getMap(), victim.getMap().findClosestSpawnpoint(victim.getTruePosition()));
                                    if (
    victim.getMapId() != c.getPlayer().getMapId()) {
                                        
    c.getPlayer().changeChannel(ch);
                                    }
                                }
                            } else {
                                
    c.getPlayer().dropMessage(6"Character is offline.");
                                return 
    0;
                            }
                        }
                    }
                    return 
    1;
                }
            }

    Notice that this command should of work like:

    @warp m 80010101

    or

    @warp m 80010101 1
    ----------------

    @warp p PlayerName



Advertisement