Welcome!

Join our community of MMORPG enthusiasts and private server developers! By registering, you'll gain access to in-depth discussions on source codes, binaries, and the latest developments in MMORPG server files. Collaborate with like-minded individuals, explore tutorials, and share insights on building and optimizing private servers. Join us today and unlock the full potential of MMORPG server development!

Join Today!

A command.

There is no such command, since a release of such a command isn't always useful to everyone (or a lot of people). But it is possible to code it.

Here is my idea of how your code should work for this command:

1) First, get the the characters in the map.
2) Store the characters names in a data structure.
3) Afterwards, create the randomization process for an index in the array that is to be printed out, and then print out which index was selected randomly.

PS: For the data structure, I'd recommend an array. However, if the randomization process is looking for a player that isn't there, then allow it to randomize again, until it finds a player that is within the map. And when it does, print out the IGN.
 
Upvote 0
I don't want to spoonfed you, but I'd recommend you to read a Java tutorial, and this code snippet should help you a bit.

// This part was written by Veda. It was taken out of the thread that you linked to.
public void mapMessage(String message) {
for (MapleCharacter map : getPlayer().getMap().getCharacters()) {
map.dropMessage(message);
}
}
 
Upvote 0
Code:
} else if (splitted[0].equals("randomplayer")) {
            for (MapleCharacter chr : player.getMap().getCharacters()) {
                player.mapMessage("The player picked was: " + );
            }

I dont know what to add into randomizer.java
 
Upvote 0
I dont know what to add into randomizer.java

I've already told you how I'd implement the code, and as I stated earlier, try to pick up some Java before attempting this. Anyways, I've decided to comment the code for you, so you have a basic idea of what you are doing.



'//' are code comments. These are ignored by the compiler, and is meant for human use. So that developers can comment the code and others can pick it up to see what they are doing.
 
Last edited:
Upvote 0
I've already told you how I'd implement the code, and as I stated earlier, try to pick up some Java before attempting this. Anyways, I've decided to comment the code for you, so you have a basic idea of what you are doing.



'//' are code comments. These are ignored by the compiler, and is meant for human use. So that developers can comment the code and others can pick it up to see what they are doing.
i know that.. I just don't know how to add in the function where it randomizes the player's name
 
Upvote 0
PHP:
} else if (sub[0].equalsIgnoreCase("randomplayer")) {
            List<String> list = new ArrayList<String>();
            for (MapleCharacter chr : player.getMap().getCharacters()) {
                list.add(chr.getName());
            }
            String[] availableChar = list.toArray(new String[list.size()]);
            int chosenChar = Randomizer.rand(0, availableChar.length);
            player.getMap().broadcastMessage(MaplePacketCreator.sendYellowTip("The chosen player was " + availableChar[chosenChar] + "."));
 
Upvote 0
PHP:
} else if (sub[0].equalsIgnoreCase("randomplayer")) {
            List<String> list = new ArrayList<String>();
            for (MapleCharacter chr : player.getMap().getCharacters()) {
                list.add(chr.getName());
            }
            String[] availableChar = list.toArray(new String[list.size()]);
            int chosenChar = Randomizer.rand(0, availableChar.length);
            player.getMap().broadcastMessage(MaplePacketCreator.sendYellowTip("The chosen player was " + availableChar[chosenChar] + "."));

thanks so much :D
 
Upvote 0
Back