0087adam
Member
Client.Java
Command Creating TuT
by Adam Waymire
© 2007 Atom Enterprises
© 2007 TTKScape
Okay, first i will tell you about the basic strings used, this is a rather long tutorial so bear with me...
First:
command.substring
if (command.equalsIgnoreCase("command");
String [Name] command.substring[#];
ok, now, the # has to replaced wit the # of characters in the command:
so it will be:
YOU MUST INCLUDE THE SPACE!
Now lets put that to use and make a command, in this case, lets use givemod.
//gives a command to start the process...
//g=1,i=2,v=3,e=4,m=5,o=6,d=7, =8
//tells what to read to put as the identification, such as name or 1111, 1111 which would be used as an object code, item code, or npc code. name would be you commanding something to happen to a player.
//Returns Player ID of the character to the server
//Turns playerID into a string
//p. refers to the other player
//newPlayerRights = 1; refers to a void that will change the player rights to 1
//updates other player
//updateRequired refers to a boolean that determines whether this happens or not; true = happens, false = not
//kicks other player so the server can save changes made to that characters file (this instance only)
//disconnected = true; also refers to a boolean.
//sends message to everyone on the server at the time.
//"}" closes the command
//PlayerHandler is used to refer to a void in another file, becuase public void messageToAll(); is in PlayerHandler.java.
Now lets explain how to make a short command that refers to a void. for this i will use an anti-noclip as an example.
Now, to make a command that activates that.
The command is fairly easy, but the void's difficulty varies greatly.
Next i will explain how to refer to multiple voids...
I will use these two voids, and btw, i've already made a command that refered to multiple voids, but it was in a void...
Them are the most commonly used voids in a server...
Also most servers have them, if not i will put them at the bottom, only when requested though...
Here is a command that would refer to 2 voids:
These Commands help stop people who will eventually be able to duplicate items. But if they realize they will be banned, then they have less of a chance to continue to attempt to duplicate items...
Yes we are about done...
Now i will teach you how to log cammands, this is simple compared to other things... It consists of a simple set of lines...
change the
to the command you are logging and the
to your line, such as if you were logging a command that gave items, you would put:
but Again, you gotta change something...
must be changed to the command the player will be using and the command you are logging, For example, for ::blkmystic, change it to:
part, if there is a specific substring, you must place it where i put:
if there is no substring, replace it with
To log multiple substrings, which is more difficult, you must have a substring, for example, if you substring represents a victim, it would look like this:
For two:
For Three:
I think you get the picture...
Moving on to using multiple substrings...
After that, i would suggest you add a log, since u got the substrings, it would go like this for this specific thing:
This concludes my command tutorial, please report any errors you may find, this is not leeched, it is my own work typed on my own computer on my own time, I'm even gonna copyright it!
This is my first major tutorial, i hope to get some feedback
Command Creating TuT
by Adam Waymire
© 2007 Atom Enterprises
© 2007 TTKScape
Okay, first i will tell you about the basic strings used, this is a rather long tutorial so bear with me...
First:
command.substring
if (command.equalsIgnoreCase("command");
String [Name] command.substring[#];
ok, now, the # has to replaced wit the # of characters in the command:
Code:
:;command string
::123456789 <= 9
YOU MUST INCLUDE THE SPACE!
Code:
String [Name] command.substring[9];
Now lets put that to use and make a command, in this case, lets use givemod.
Code:
[code]
if (command.startsWith("givemod") { //::givemod [playername]
Code:
String name command.substring[8];
//tells what to read to put as the identification, such as name or 1111, 1111 which would be used as an object code, item code, or npc code. name would be you commanding something to happen to a player.
Code:
PlayerHandler.getPlayerID(name);
Code:
client = c PlayerHandler.playerID = p;
Code:
p.newPlayerRights = 1;
//newPlayerRights = 1; refers to a void that will change the player rights to 1
Code:
p.updateRequired = true;
//updateRequired refers to a boolean that determines whether this happens or not; true = happens, false = not
Code:
p.disconnected = true;
//disconnected = true; also refers to a boolean.
Code:
PlayerHandler.messageToAll = "name+ just became moderator!";
}
//"}" closes the command
//PlayerHandler is used to refer to a void in another file, becuase public void messageToAll(); is in PlayerHandler.java.
Now lets explain how to make a short command that refers to a void. for this i will use an anti-noclip as an example.
NOTE: You must have the proper int for this void to work!
Code:
public void noClip();
{
if (noclips == 0)
{
sendMessage("You are not allowed to use :;noclip on this server");
sendMessage("If you do it again you will be punished");
sendMessage("Thank you for understanding, 0087adam");
}
else if (noclips == 1);
{
disconnected = true;
sendMessage("You have attempted to use noclip again");
sendMessage("You have been Kicked this time");
sendMessage("There is further punishment possible");
sendMessage("Nexy offence = ban");
}
else if(noclips == 2);
sendMessage("You little rat! You've done it again, you");
sendMessage("are about to be temporarily banned");
sendMessage("I may be able to get your account Unbanned");
appendToBanned(playerName);
[insert buffered writer here]
}
else if(noclips == 3)
{
sendMessage("3 strikes, your banned!");
sendMessage("Now it counts by IP! So");
sendMessage("You better watch out, your");
sendMessage("next offence from your IP is");
sendMessage("a temporary IP BAN!, any ");
sendMessage("offences after that is a ");
sendMessage("permanant IP Ban! =O");
appendToBanned();
}
else if(noclips == 4)
{
sendMessage("Wow, you did it again you little");
sendMessage("shit, you now have a temporary");
sendMessage("IP Ban, it will expire in 3 days");
sendMessage("Maybe now you will learn...");
appendToTemporaryIPBanned();
}
else if(noclips == 5)
{
sendMessage("You have tried my patience!");
sendMessage("You will now go on the Wall Of Shame!");
sendMessage("This may be negotiable, but for now...");
sendMessage("Its Permanant, Have a nice life...");
appendToIPBanned();
}
}
Now, to make a command that activates that.
Code:
if(command.equalsIgnoreCase("noclip") && playerRights != 3);
{
noclip();
}
The command is fairly easy, but the void's difficulty varies greatly.
Next i will explain how to refer to multiple voids...
I will use these two voids, and btw, i've already made a command that refered to multiple voids, but it was in a void...
Code:
public void appendToMacroWarn();
public void appendToFlagged();
public void appendToFlaggedAsAuto();
public void appendToBanned();
public void appendToIpBanned();
public void appendToWarned();
Also most servers have them, if not i will put them at the bottom, only when requested though...
Here is a command that would refer to 2 voids:
Code:
else if(command.equalsIgnoreCase("dupe"))
{
appendToWarned();
appendToFlagged();
appendToBanned();
}
else if(command.equalsIgnoreCase("duplicate"))
{
appendToWarned();
appendToFlagged();
appendToBanned();
}
else if(command.equalsIgnoreCase("dupeitem"))
{
appendToWarned();
appendToFlagged();
appendToBanned();
}
Yes we are about done...
Now i will teach you how to log cammands, this is simple compared to other things... It consists of a simple set of lines...
Code:
[Insert BW here]
Code:
[Destination]
Code:
[Message]
Code:
playerName+" has just used [command]"
Code:
[command]
Code:
playerName+" has spawned themself some black mystic using ::blkmystic!"
part, if there is a specific substring, you must place it where i put:
Code:
[SubString]
Code:
playerName+
For two:
Code:
playerName+" Banned "+victim+" Fur Realz!"
For Three:
Code:
playerName+" Banned "+victim+"! Reason: "+reason
I think you get the picture...
Moving on to using multiple substrings...
Code:
else if(command.startsWith("Banuser");
// Banuser [character] [reason]
try {
String Victim = command.substring(8,20);
String Reason = command.substring(21);
PlayerHandler.messageToAll = Victim+" just got banned for "+Reason;
appendToBanned(Victim);
After that, i would suggest you add a log, since u got the substrings, it would go like this for this specific thing:
Code:
playerName+" banned "+Victim+" For "+Reason
This concludes my command tutorial, please report any errors you may find, this is not leeched, it is my own work typed on my own computer on my own time, I'm even gonna copyright it!
This is my first major tutorial, i hope to get some feedback

