GamerzLife
Welcome to GamerzLife. Please register or log in. Please try to be as active as possible. Thank You, Please Donate to help us out. And get VIP or Donator Status. And help support our upcoming Private Server. Thank You!
GamerzLife

The Only Way to Game
 
HomeHome  HomeHome  RegisterRegister  Log inLog in  
Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Navigation
 Home
 Forum
 User Cp
 Faq
 GamerzLife VIP
 Donate
 Youtube
 ChatBox
 
Donate
Forum Status
hit counters
Since Sunday June 14, 2009
Latest topics
» How to save your time in finding a good web design team.
Tue Mar 15, 2011 2:20 am by MelissaGods

» what xp you need for next rank guide
Fri Jul 17, 2009 5:23 pm by odosama01

» Howz it goin?
Fri Jul 17, 2009 5:22 pm by odosama01

» Rohan Gaming Quality
Fri Jul 17, 2009 5:20 pm by odosama01

» Too Many Hackers on SF...
Fri Jul 17, 2009 5:17 pm by odosama01

» Go to Desperia.com
Fri Jul 17, 2009 5:11 pm by odosama01

» HI IM JUSTIN JACKASS
Mon Jul 13, 2009 7:41 pm by Resistance

» Tales of Vesparia can take u a while...
Mon Jul 13, 2009 1:53 am by j u s t i n

» hey guys add me on here
Fri Jul 10, 2009 11:16 pm by odosama01

Top posters
Resistance
 
Datzmark
 
kingddh2
 
j u s t i n
 
Drakren
 
odosama01
 
Tanakanator
 
sl33py
 
Jose
 
bluepool17
 

Share | 
 

 Beginner TUT: Creating Commands.

View previous topic View next topic Go down 
AuthorMessage
Resistance



Posts : 149
Points : 179
Join date : 2009-05-23
Age : 21
Location : Australia

PostSubject: Beginner TUT: Creating Commands.   Sun Jun 28, 2009 12:35 am

Files edited: Client.java
Difficulty: 1/10

Procedure:

Open your Client.java and search for:
Code:
   private void customCommand

This is the list of all the commands. We will add all of our created commands under this.

Teleport Commands:

This section will teach you about commands that will teleport you to a set of coords.

Procedure:

We are going to start our 'if' statement.

Code:
if (command.equalsIgnoreCase(“train”)) {

Explaining – This first line of code is very simple. Command.equalsIgnoreCase means that if the command is equal to “train” then the rest of our command will initialize. This is different from command.startswith which is mostly used in 2 parted commands such as ::banuser username. (“train”) is the command name.

Code:
&& playerRights >= 0

is not needed unless you are setting it for mod or higher use only.

Now that we have our if statement we need to create the body for it.

Code:
toX = 3333;
          toY = 3333;

Explaining – This is also very straight forward. If you do ::train it will teleport you to the x and y coords listed. toX and toY are our variables for teleporting.


Now we need to close the command by adding a closing bracket.

Code:
}

So this is our teleport command:
Code:
if (command.equalsIgnoreCase(“train”)) {
       toX = 3333;
             toY = 3333;
}

If you want you can also add a message that will be sent to the player when using the command.

Before the closing bracket add:

Code:
sM(“you teleport to train”);

Explaining – sM is our variable for sending messages to the user via the chat. It will not open as an interface. Inside (“”) goes the message you want.

Add item Commands:

This section will teach you about commands that with add items to the players inventory.

Procedure:

We are going to start our 'if' statement.

Code:
if (command.equalsIgnoreCase(“items”)) {

Explaining – This first line of code is very simple. Command.equalsIgnoreCase means that if the command is equal to “items” then the rest of our command will initialize. This is different from command.startswith which is mostly used in 2 parted commands such as ::banuser username. (“items”) is the command name.

Code:
&& playerRights >= 0
is not needed unless you are setting it for mod or higher use only.


Now we need to add a body to it.

Code:
addItem(1050 ,1);

Explaining – addItem is the variable that will place the item and amount listed inside the set of () to the player inventory. Inside the parenthesis follows this: (item ID, amount).


Now just close the command using a -
[code]Explaining – addItem is the variable that will place the item and amount listed inside the set of () to the player inventory. Inside the parenthesis follows this: (item ID, amount).


Now just close the command using a -

Quote :
}

Note: Add additional -
[code]addItem(item ID, amount);[/code]

for the more items you want the command to give.


Give Skill exp Commands:

This section will teach about creating a command that will add Experience a skill(s).

Procedure (using an integer):

We are going to start our 'if' statement.

Quote :
if (command.equalsIgnoreCase(“pure”)) {

Explaining – This first line of code is very simple. Command.equalsIgnoreCase means that if the command is equal to “pure” then the rest of our command will initialize. This is different from command.startswith which is mostly used in 2 parted commands such as ::banuser username. (“pure”) is the command name.


Quote :
&& playerRights >= 0
is not needed unless you are setting it for mod or higher use only.

Next we need to create a body.
Quote :
for (int i = 0; i < 22; i++)
{
if (i != 1 && i!= 5)
addSkillXP(15000000, i);
}
}

Explaining – this creates the integer for “i”. i < 22 means that “I” will be equal to 21 and lower. This makes it stand for every skill from 1-21. Then it isolates the skills numbers you want/don’t want. != 1 means NOT equal to 1, therefore it will not add to skill 1. && i! = 5, once again it will not add to skill 5. addSkillXP is the variable for adding skill exp. It is used in the format:

[code]addSkillXP(Exp amount, skill number[/code]

In this case our skill number is “i” which represents multiple skills.

Now close our command using a -

Quote :
}

Procedure (listing every skill):

We are going to start our 'if' statement.

Quote :
if (command.equalsIgnoreCase(“pure”)) {


Explaining – This first line of code is very simple. Command.equalsIgnoreCase means that if the command is equal to “pure” then the rest of our command will initialize. This is different from command.startswith which is mostly used in 2 parted commands such as ::banuser username. (“pure”) is the command name.

Quote :
&& playerRights >= 0

is not needed unless you are setting it for mod or higher use only.

Next we need to create a body.
Quote :
addSkillXP(15000000, 0);
addSkillXP(15000000, 2);
addSkillXP(15000000, 3);
addSkillXP(15000000, 4);
addSkillXP(15000000, 6);

Explaining – addSkillXP is the variable for adding exp to a skill. It follows the format of

Quote :
addSkillXP(exp amount, skill number);

Each skill has a corresponding number.


Now we close our command using a -

Quote :
}

Changing Player-Rights Commands:

This section will teach you how to add commands to change a players rights.
Player-rights:
0 = Normal Player
1 = Moderator
2 = Administrator
3 = Owner/Co-Owner
4 = Hidden Owner/Admin

Procedure:

We are going to start our 'if' statement.

Quote :
if (command.startswith(“makemod”) && playerRights >= 2) {

Explaining – This first line of code is very simple. Command.startswith means that if the command is starts with “makemode” then the rest of our command will initialize. Command.startsWith is used when you are creating a command that is used upon a different player or uses a substring. This is different from command.equalsIgnoreCase which is mostly in commands that give items, add skill xp, or teleport you somewhere. (“makemod”) is the command name.

Quote :
&& playerRights >= 2

means that only players that have 2 or higher rights can use this command.


Now we need to create a body.
Quote :
String otherPName = command.substring(Cool;
int otherPIndex = PlayerHandler.getPlayerID(otherPName);

client p = (client) server.playerHandler.players[otherPIndex];
p.rights = 1
p.sM(
"You are now a Moderator);
} else {
sM("The name doesnt exist.");
}
} catch (Exception e) {
sM("Try entering a name you want to make a mod..");

Explaining – the command.substring(Cool represents where the command ends and where the username begins. The substring must be equal to the command name (not the :: before it when you type it in-game) and the space after it. otherPIndex is an integer that is equal to PlayerHandler.getPlayerID(otherPName);. This is used to check if that username exists. Now we need to temporarily create the variable used, client p. This says that it will not change rights but will change the other players rights. If the playername does not exist it will send a message (sM) telling you that it does not.


Now we need to close our command with a -
Quote :
}

NOTE: Edit the commands to your needs and wants. They are just used as a base to show you what it is like.

I did not write this, I give full credits to -

100% - Darkning

~Kevin.
Back to top Go down
Datzmark
Founder & Owner
Founder & Owner
avatar

Posts : 120
Points : 264
Join date : 2009-05-08
Age : 27
Location : My Computer

PostSubject: Re: Beginner TUT: Creating Commands.   Sun Jun 28, 2009 2:16 am

Wow your the master biatch!. I freaken love u! pro Sticky cuz ur freshhh
Back to top Go down
http://www.gamerzlife.com
Resistance



Posts : 149
Points : 179
Join date : 2009-05-23
Age : 21
Location : Australia

PostSubject: Re: Beginner TUT: Creating Commands.   Mon Jun 29, 2009 2:40 am

I'm more pro than you. GF.
Back to top Go down
odosama01

avatar

Posts : 51
Points : 103
Join date : 2009-05-21
Location : earth

PostSubject: Re: Beginner TUT: Creating Commands.   Mon Jun 29, 2009 9:11 pm

very nice, idk wut i'd use it for, but very nice anyways. =)
Back to top Go down
j u s t i n

avatar

Posts : 97
Points : 152
Join date : 2009-05-25
Age : 25
Location : bama

PostSubject: Re: Beginner TUT: Creating Commands.   Mon Jun 29, 2009 9:25 pm

lol i would use this if i could get teh way runelocus says todo i cant put my ip into adress bar soo yeah nice but i cant use either
Back to top Go down
Resistance



Posts : 149
Points : 179
Join date : 2009-05-23
Age : 21
Location : Australia

PostSubject: Re: Beginner TUT: Creating Commands.   Tue Jun 30, 2009 3:18 am

Thanks. Wink
Back to top Go down
j u s t i n

avatar

Posts : 97
Points : 152
Join date : 2009-05-25
Age : 25
Location : bama

PostSubject: Re: Beginner TUT: Creating Commands.   Tue Jun 30, 2009 5:09 pm

no problem but try and make your post longer or you will get a warn like me Sad
Back to top Go down
Resistance



Posts : 149
Points : 179
Join date : 2009-05-23
Age : 21
Location : Australia

PostSubject: Re: Beginner TUT: Creating Commands.   Wed Jul 01, 2009 3:43 am

I'll try to make them longer. L. GRATZ ON ADMIN.
Back to top Go down
Datzmark
Founder & Owner
Founder & Owner
avatar

Posts : 120
Points : 264
Join date : 2009-05-08
Age : 27
Location : My Computer

PostSubject: Re: Beginner TUT: Creating Commands.   Wed Jul 01, 2009 6:57 pm

no its not... Please do not say that. Read rules
Back to top Go down
http://www.gamerzlife.com
j u s t i n

avatar

Posts : 97
Points : 152
Join date : 2009-05-25
Age : 25
Location : bama

PostSubject: Re: Beginner TUT: Creating Commands.   Sun Jul 05, 2009 3:28 pm

thanks resistance for the way your teh first to notice xD and if you got a tip about the ip address into teh address bar i will love you forever xD
Back to top Go down
Sponsored content




PostSubject: Re: Beginner TUT: Creating Commands.   

Back to top Go down
 
Beginner TUT: Creating Commands.
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» My 1500 pts. Army - beginner
» Skeleton.exe executes commands from an attacker?
» Advice for creating a toy room
» Chaos Daemons for a beginner
» Creating Account Taiwan

Permissions in this forum:You cannot reply to topics in this forum
GamerzLife :: Gamerzlife Runescape P.Server Community :: Runescape 2 Server Emulation :: Server Tutorials-
Jump to: