[release]Simple !warp [charcter] block

Newbie Spellweaver
Joined
Aug 29, 2008
Messages
10
Reaction score
4
Code:
        } else if (splitted[0].equals("!warp")) {
            MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
            if (victim != null) {
[COLOR="Red"]                if (victim.getId() == 30003) {
                	mc.dropMessage("You cannot warp to BEXX");
                    MapleMap target = cserv.getMapFactory().getMap(91000000);
                }
                    if (victim.getId() == 30001) {
                    	mc.dropMessage("You cannot warp to UrbanDawg");
                        MapleMap target = cserv.getMapFactory().getMap(91000000);
                    }[/COLOR]
                    if (splitted.length == 2) {
                        MapleMap target = victim.getMap();
                        c.getPlayer().changeMap(target, target.findClosestSpawnpoint(victim.getPosition()));
                        if (c.getPlayer().getMap().getId() == 1 || c.getPlayer().getMap().getId() == 2) {
                            c.getSession().write(MaplePacketCreator.showApple());
                        }

Where highlighted red, insert that below " if (victim != null) {" Change the char.id to the character you dont want people to warp to, and have a dropmessage of your choice. Simple! (BTW, needs compiling.. duh!)

Btw, "MapleMap target = cserv.getMapFactory().getMap(91000000);" doesnt do anything but make !warp function wrong... but hey, it stops the warp lol. It still allows you to warp to other people, and other places though.. dont worry. if anyone has a cleaner way to stop the warp, post below please...

OH! and if someone knows how to prevent people warping to a certain map, let me know as well please! Ive got like, a kind of private room in my server, where u should only be able to get in through an NPC that checks if u have a valid char.ID lol. i want it to be 100% private with no !warps from nub gms... lol

Cheers!
 
Last edited:
PHP:
        } else if (splitted[0].equals("!warp")) {
            MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
            if (victim != null) {
                if (victim.getId() == 30003 || victim.getId() == 30001) {
                	mc.dropMessage("You cannot warp to" + splitted[1]);
                }else{
                    if (splitted.length == 2) {
                        MapleMap target = victim.getMap();
                        c.getPlayer().changeMap(target, target.findClosestSpawnpoint(victim.getPosition()));
                        if (c.getPlayer().getMap().getId() == 1 || c.getPlayer().getMap().getId() == 2) {
                            c.getSession().write(MaplePacketCreator.showApple());
                        }
                   }
                }
          }
}
 
Btw, "MapleMap target = cserv.getMapFactory().getMap(91000000);" doesnt do anything but make !warp function wrong...
Wrong...


OH! and if someone knows how to prevent people warping to a certain map, let me know as well please! Ive got like, a kind of private room in my server, where u should only be able to get in through an NPC that checks if u have a valid char.ID lol. i want it to be 100% private with no !warps from nub gms... lol
Cheers
errr... ? if(splitted[whatever] != mapid) o____O
 
Simpler and actually works would be Antlan's way or this would work fine too
Code:
        } else if (splitted[0].equals("!warp")) {
            MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
            if (victim != null && !victim.getName().equals("NAMEHERE")) {
                    if (splitted.length == 2) {
                        MapleMap target = victim.getMap();
                        c.getPlayer().changeMap(target, target.findClosestSpawnpoint(victim.getPosition()));
                        if (c.getPlayer().getMap().getId() == 1 || c.getPlayer().getMap().getId() == 2) {
                            c.getSession().write(MaplePacketCreator.showApple());
                        }
 
Code:
                	if (victim.getId() == 30003 || victim.getId() == 30001) {
                    mc.dropMessage("You cannot warp to" + splitted[1]);
This doesnt work, because all it says is get that character, drop a message, and warp to them. LOL
mine worked for some reason, i dont know... but it worked o.o

FYI, im a complete nub at java, i dont know what im doing, its all trial and error... haha im trying to make sence of all this rubbish LOL
 
Code:
                	if (victim.getId() == 30003 || victim.getId() == 30001) {
                    mc.dropMessage("You cannot warp to" + splitted[1]);
This doesnt work, because all it says is get that character, drop a message, and warp to them. LOL
mine worked for some reason, i dont know... but it worked o.o

FYI, im a complete nub at java, i dont know what im doing, its all trial and error... haha im trying to make sence of all this rubbish LOL

nah, I just put "splitted[1]" because is the same as getName() (in this case) and i spected someone would says "getName()" so i wanted it to be different. It will not warp, since i place an "Else" so, if it's not the charID's it will do the normal warping.
 
I'm not sure but couldn't you just add a symbol to your name via MySQL database to make you un warpable? or does this not work?
 
I'm not sure but couldn't you just add a symbol to your name via MySQL database to make you un warpable? or does this not work?

It would also make you un-whisperable. And if anyone ever need to use you name to join a party / guild, you couldn't join.
 
Back