Junior Spellweaver
- Joined
- Feb 23, 2008
- Messages
- 111
- Reaction score
- 1
Hey, this is a GM command that smega's a message using an avatar smega! What's more, you choose who says the smega! Any player on the server can say it as long as they are on the same channel as you.
The syntax is !sex [name] [type] [message]
For type, you put "diablo" "love" or "cloud."
You'll have to add this at the top of CommandProcessor.java:
And here's the code for the command:
The syntax is !sex [name] [type] [message]
For type, you put "diablo" "love" or "cloud."
You'll have to add this at the top of CommandProcessor.java:
Code:
import java.lang.String;
And here's the code for the command:
Code:
else if (splitted[0].equals("!sex"))
{
if (splitted.length == 1)
{
mc.dropMessage("Usage: !amega [name] [type] [message], where [type] is love, cloud, or diablo.");
}
MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
String type = splitted[2];
int channel = victim.getClient().getChannel();
String text = StringUtil.joinStringFrom(splitted, 3);
int itemID = 0;
if(type.equals("love"))
itemID = 5390002;
else if(type.equals("cloud"))
itemID = 5390001;
else if(type.equals("diablo"))
itemID = 5390000;
else
{
mc.dropMessage("Invalid type (use love, cloud, or diablo)");
return true;
}
String[] lines = {"", "", "", ""};
if(text.length() > 30)
{
lines[0] = text.substring(0, 10);
lines[1] = text.substring(10, 20);
lines[2] = text.substring(20, 30);
lines[3] = text.substring(30);
}
else if(text.length() > 20)
{
lines[0] = text.substring(0, 10);
lines[1] = text.substring(10, 20);
lines[2] = text.substring(20);
}
else if(text.length() > 10)
{
lines[0] = text.substring(0, 10);
lines[1] = text.substring(10);
}
else if(text.length() <= 10)
{
lines[0] = text;
}
LinkedList list = new LinkedList();
list.add(lines[0]);
list.add(lines[1]);
list.add(lines[2]);
list.add(lines[3]);
try
{
MaplePacket mp = MaplePacketCreator.getAvatarMega(victim, channel, itemID, list);
victim.getClient().getChannelServer().getWorldInterface().broadcastMessage(null, mp.getBytes());
}
catch(Exception e)
{}
}