Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

New method for @go command

Newbie Spellweaver
Joined
Apr 30, 2009
Messages
54
Reaction score
12
This is pretty simple java coding that uses arrays

declare theese fields in PlayerCommand:
PHP:
	private static String mapName[] = {"henesys", "ellinia", "perion", "kerning", "sleepy"};
	private static int mapID[] = {100000000, 101000000, 102000000, 103000000, 105040300};

add this before the execute method

PHP:
	private static int getMapEle(String a) {
		int el = -1;
		int i = 0;
		while (i < mapName.length) {
			if (mapName[i] == a) {
				el = i;
			} else {
				i++;
			}
		}
		return el;
	}


and for command do this

PHP:
} else if (splitted[0].equals("@go") && (player.getMapId() > 1020002)) {
			if (splitted[1] != null) {
				String name = splitted[1];
				int ele = getMapEle(name);
				if (ele != -1) {
					player.changeMap(mapID[ele]);
					player.dropMessage("Please feel free to suggest any more locations");
				} else {
					player.dropMessage("Only the map below may be warped to:");
					for (int i = 0; i < mapName.length; i++) {
						player.dropMessage(mapName[i]);
					}
				}
			} else {
				player.dropMessage("please use  @go <mapname>  for this command to work");
			}

to add more map

just simply add more map to mapName and the mapID to match the same element or this will not work

for example

PHP:
private static String mapName[] = {"henesys", "ellinia", "perion", "kerning", "sleepy", "newMapname"};
	private static int mapID[] = {100000000, 101000000, 102000000, 103000000, 105040300, newMapID};
and so on (remember the mapName is a string you you have to put quotes around your map name)

remember the space the map name and map id with a comma or it wont work :thumbup:

I dont care if u post this anywhere else just leave credits
thank me if this is useful for you
 
Last edited:
Custom Title Activated
Loyal Member
Joined
Nov 27, 2009
Messages
1,905
Reaction score
948
Why can't every release on ragezone be tested? T^T
 
Legendary Battlemage
Joined
Mar 30, 2009
Messages
672
Reaction score
676
The command could be better if you use "contains" so that they don't have to type out the whole name of the map.
 
Newbie Spellweaver
Joined
Mar 29, 2009
Messages
19
Reaction score
0
its not working for me. it wont compile >_>

Code:
.....\src\net\sf\odinms\client\messages\commands\PlayerCommands.java:186: cannot find symbol
symbol  : method containsKey(java.lang.String)
location: class java.lang.Object
                } else if (maps.containsKey(splitted[1])) {
.....\src\net\sf\odinms\client\messages\commands\PlayerCommands.java:187: cannot find symbol
symbol  : method get(java.lang.String)
location: class java.lang.Object
                    int map = maps.get(splitted[1]);
.....\src\net\sf\odinms\client\messages\commands\PlayerCommands.java:196: cannot find symbol
symbol  : method clear()
location: class java.lang.Object
                maps.clear();
 
Last edited:
Banned
Banned
Joined
Nov 17, 2009
Messages
104
Reaction score
30
by looking at it, this would work fine. it can be improved though.

For those who don't want a map check, just delete
Code:
&& (player.getMapId() > 1020002

so it would look like

Code:
} else if (splitted[0].equals("@go")) {
 
Last edited:
Junior Spellweaver
Joined
Nov 12, 2009
Messages
163
Reaction score
7
its not working for me. it wont compile >_>

Code:
.....\src\net\sf\odinms\client\messages\commands\PlayerCommands.java:186: cannot find symbol
symbol  : method containsKey(java.lang.String)
location: class java.lang.Object
                } else if (maps.containsKey(splitted[1])) {
.....\src\net\sf\odinms\client\messages\commands\PlayerCommands.java:187: cannot find symbol
symbol  : method get(java.lang.String)
location: class java.lang.Object
                    int map = maps.get(splitted[1]);
.....\src\net\sf\odinms\client\messages\commands\PlayerCommands.java:196: cannot find symbol
symbol  : method clear()
location: class java.lang.Object
                maps.clear();

add the methods in then?
 
Elite Diviner
Loyal Member
Joined
Feb 1, 2009
Messages
497
Reaction score
75
My version. Moogra approved! No tested and I don't mind to x)

PHP:
else if (splitted[0].equals("go")){
            int[] mapIds = {1,2,3,4,5,6};
            MapleMapFactory lol = null;
            for(int all : mapIds)
                if(splitted[1].equalsIgnoreCase(lol.getMap(mapIds[all]).getMapName()) || splitted[1].equals(Integer.valueOf(mapIds[all]).toString())){
                    player.changeMap(lol.getMap(mapIds[all]));
                    player.dropMessage("You have been warped to " + lol.getMap(mapIds[all]).getMapName() + ".");
                    return;
                }
            player.dropMessage("Invalid map name or ID.");
 
Newbie Spellweaver
Joined
Mar 29, 2009
Messages
19
Reaction score
0
My version. Moogra approved! No tested and I don't mind to x)

PHP:
else if (splitted[0].equals("go")){
            int[] mapIds = {1,2,3,4,5,6};
            MapleMapFactory lol = null;
            for(int all : mapIds)
                if(splitted[1].equalsIgnoreCase(lol.getMap(mapIds[all]).getMapName()) || splitted[1].equals(Integer.valueOf(mapIds[all]).toString())){
                    player.changeMap(lol.getMap(mapIds[all]));
                    player.dropMessage("You have been warped to " + lol.getMap(mapIds[all]).getMapName() + ".");
                    return;
                }
            player.dropMessage("Invalid map name or ID.");

that one works but i keep getting this

Code:
.....\src\net\sf\odinms\client\messages\commands\PlayerCommands.java:327: ';' expected
    public CommandDefinition[] getDefinition() {
1 error

but its not from putting that in i think its from putting in the

Code:
private static String mapName[] = {"henesys", "ellinia", "perion", "kerning", "sleepy", "fm", "lith", "florina", "orbis", "happy", "shrine", "amoria", "showa", "nlc", "korean", "omega", "excavation", "guild", "mulung", "herb", "ludi", "elnath"};
    private static int mapID[] = {100000000, 101000000, 102000000, 103000000, 105040300, 910000000, 104000000, 110000000, 200000000, 209000000, 800000000, 680000000, 801000000, 600000000, 222000000, 221000000, 990000000, 200000301, 250000000, 251000000, 220000000, 211000000};
 
Elite Diviner
Loyal Member
Joined
Feb 1, 2009
Messages
497
Reaction score
75
that one works but i keep getting this

Code:
.....\src\net\sf\odinms\client\messages\commands\PlayerCommands.java:327: ';' expected
    public CommandDefinition[] getDefinition() {
1 error

but its not from putting that in i think its from putting in the

Code:
private static String mapName[] = {"henesys", "ellinia", "perion", "kerning", "sleepy", "fm", "lith", "florina", "orbis", "happy", "shrine", "amoria", "showa", "nlc", "korean", "omega", "excavation", "guild", "mulung", "herb", "ludi", "elnath"};
    private static int mapID[] = {100000000, 101000000, 102000000, 103000000, 105040300, 910000000, 104000000, 110000000, 200000000, 209000000, 800000000, 680000000, 801000000, 600000000, 222000000, 221000000, 990000000, 200000301, 250000000, 251000000, 220000000, 211000000};

Nah, you just fail at placing the code.
 
Junior Spellweaver
Joined
Jun 12, 2009
Messages
116
Reaction score
1
i get this error when compiling :O

Code:
...\src\net\sf\odinms\client\messages\PlayerCommand.java:153: cannot find symbol
symbol  : method changeMap(int)
location: class net.sf.odinms.client.MapleCharacter
                    player.changeMap(mapID[ele]);
1 error
BUILD FAILED (total time: 6 seconds)

lol
 
may web.very maple.pls.
Loyal Member
Joined
Aug 12, 2009
Messages
1,810
Reaction score
606
u bumped a hella thread
 
Back
Top