Name of TuT: How to add commands too your pserver.
Difficulty: 1/10 <- barely.
What too do: Copy + paste (Ctrl + F)
Credits: Me and only me, not very much too take credits for
a little extra: Just if you want too talk to me live or ingame on my server the Address/IP is 0nlyscape.no-ip.org with a zero at start, and my email is: [Only registered and activated users can see links. ], report any errors or difficulties you get, if you have any. ( well duuuh )
Okey first off all, im gonna teach you how to make custom commands which could either teleport you, give items or sendmessages, etc. and after how to add playerRights too them: That means you will have to have a certain ingame rank/status, 0 means player - 1 means mod - 2 means admin... etc. so that if you choose too have playerRights for the commands i will teach you how too do it. Lets start off with opening client.java, press ctrl + f and search for:
Code:
public void customCommand(String command) {
under this you might see this:
this is the code for ::afk
Code:
if (command.startsWith("afk")) {
startAnimation(1353);
updateRequired = true;
appearanceUpdateRequired = true;
txt4 = "didnt i mention? IM AFK!";
string4UpdateRequired = true;
}
This is the code for the command ::afk, you might wanna add this cause it comes in handy if your going to the toilet, watchin videos/coding etc...
ann under here is ::back
And here is the command to get back from ::afk... ::back
Code:
if (command.startsWith("back")) {
startAnimation(1);
updateRequired = true;
appearanceUpdateRequired = true;
txt4 = "im back in black!";
string4UpdateRequired = true;
}
Now, its important you space it right if it isent already!
Now ill just write how to add your own easy commands: just search for any command you already got, and find the bracket '}'
after a command if you dont know how to already... the bracket -> '}' means that the code is ended and therefor you can add a new one after it.
'{' means its opening the code... common sense really. okey, lets see. i think ive told the most already(if theres anything else, just contact me.)
A command without playerRights ->
Code:
if (command.startsWith("Put in the name of command here")) {
addItem(ItemID here, Amount here);
sendMessage("Message to send when code is entered here");
startAnimation(animationID / number here);
}
thats a regular command without any playerRights or extra hardcore stuff. Now, ill show a command code with playerRights ->
Code:
if (command.equalsIgnoreCase("command name here") && playerRights >= 0) {
addItem(ItemID, Amount);
startAnimation(animationID / Number here);
sendMessage("Message here");
}
You can add more of the "addItems, sendmessages of course, if you want a food command it would be like this:
if (command.equalsIgnoreCase("command name here") && playerRights >= 0) {
teleportToX = Xcords here;
teleportToY = Ycords here;
heightLevel = 0;
sendMessage("Put your message here.");
}
(If theres anything else of commands or such you want me too give you, or post here, just Pm me or contact me at all.)
this Tutorial was made by me and only me, i had some free time and i wanted to give something too the community newbeginners, etc. Have fun, and go code! Peace out.
Code ftw.
If i dont get any feedback or comments or anything at all, ill just remove, doesnt matter too much then... :/
Last edited by Only; 09-06-2008 at 12:53 AM.
Reason: Double posting is not allowed!
client.java:7606: cannot find symbol
symbol : variable txt4
location: class client
txt4 = "didnt i mention? IM AFK!";
^
client.java:7607: cannot find symbol
symbol : variable string4UpdateRequired
location: class client
string4UpdateRequired = true;
^
2 errors
Finished!
Press any key to continue . . .
=\
not tryin to be mean or anything but your server is kinda bad
Last edited by Purp; 09-29-2008 at 05:10 AM.
Reason: Double posting is not allowed!
Owner of CivilScape
http://www.rune-server.ee/f522/24-7-civilscape-24-7-t110852.html
client.java:7606: cannot find symbol
symbol : variable txt4
location: class client
txt4 = "didnt i mention? IM AFK!";
^
client.java:7607: cannot find symbol
symbol : variable string4UpdateRequired
location: class client
string4UpdateRequired = true;
^
2 errors
Finished!
Press any key to continue . . .
=\
not tryin to be mean or anything but your server is kinda bad
No, YOUR server is the bad one here, You dont have those variables.
client.java:7606: cannot find symbol
symbol : variable txt4
location: class client
txt4 = "didnt i mention? IM AFK!";
^
client.java:7607: cannot find symbol
symbol : variable string4UpdateRequired
location: class client
string4UpdateRequired = true;
^
2 errors
Finished!
Press any key to continue . . .
=\
not tryin to be mean or anything but your server is kinda bad
Add them variables, they will also come in handy in the futre.
That will clear the errors.
“If at first, the idea is not absurd, then there is no hope for it” - Albert Einstein
My server aint that bad but its not good, because i dont use no time coding it, because im at this site helping peoples 24/7!!!
And how can your server be any better when you dont have the txt4 vars lol ? ... If you cant do that yourself then dont bother doing this lol...