Thread: [PI] Make a Master/Pure Command with Single use. Noob Friendly.

Page 1 of 3 123 LastLast
Results 1 to 10 of 28
  1. #1 [PI] Make a Master/Pure Command with Single use. Noob Friendly. 
    Member
    Join Date
    Aug 2010
    Posts
    78
    Thanks given
    32
    Thanks received
    10
    Rep Power
    0
    To start off please don't flame I know this is basic this is just to help some kids out .

    In this tutorial I will show you how to make a Master and Pure command and how to make it only be able to be used once. I will also explain a little bit in this tutorial.

    A Master command will give you 99 attack strength defence range mage and prayer.
    A Pure command will give you 99 attack strength range mage.

    First go to

    src/server/model/players/packets and open Commands.java

    And add this for your Master command

    Code:
    			if (playerCommand.startsWith("master") && c.master == 0) {
    				int i = 0;		
    				c.getPA().addSkillXP((15000000), 0);
    				c.getPA().addSkillXP((15000000), 1);
    				c.getPA().addSkillXP((15000000), 2);
    				c.getPA().addSkillXP((15000000), 3);
    				c.getPA().addSkillXP((15000000), 4);
    				c.getPA().addSkillXP((15000000), 5);
    				c.getPA().addSkillXP((15000000), 6);
    				c.playerXP[3] = c.getPA().getXPForLevel(99)+5;
    				c.playerLevel[3] = c.getPA().getLevelForXP(c.playerXP[3]);
    				c.getPA().refreshSkill(3);
    				c.master = 1;
    			}
    Pure Command

    Code:
    			if (playerCommand.startsWith("pure") && c.pure == 0) {
    				int i = 0;		
    				c.getPA().addSkillXP((15000000), 0);
    				c.getPA().addSkillXP((15000000), 2);
    				c.getPA().addSkillXP((15000000), 3);
    				c.getPA().addSkillXP((15000000), 4);
    				c.getPA().addSkillXP((15000000), 6);
    				c.playerXP[3] = c.getPA().getXPForLevel(99)+5;
    				c.playerLevel[3] = c.getPA().getLevelForXP(c.playerXP[3]);
    				c.getPA().refreshSkill(3);
    				c.pure = 1;
    			}
    Explanation of command code.

    c.getPA().addSkillXP((15000000), 0);

    This is the amount of xp the skill will be given
    This is the skill id in this case attack

    The rest are as follows (Click Spoiler)

    Spoiler for Click here for rest of combat skills id:
    0 = Attack
    1 = Defence
    2 = Strength
    3 = Hit points
    4 = Range
    5 = Prayer
    6 = Mage


    To make a command Donator only (This will not work with all servers)
    add

    Code:
     && c.isDonator == 1
    So it would look something like...

    Code:
    			if (playerCommand.startsWith("master") && c.isDonator == 1 && c.master == 0) {
    				int i = 0;		
    				c.getPA().addSkillXP((15000000), 0);
    				c.getPA().addSkillXP((15000000), 1);
    				c.getPA().addSkillXP((15000000), 2);
    				c.getPA().addSkillXP((15000000), 3);
    				c.getPA().addSkillXP((15000000), 4);
    				c.getPA().addSkillXP((15000000), 5);
    				c.getPA().addSkillXP((15000000), 6);
    				c.playerXP[3] = c.getPA().getXPForLevel(99)+5;
    				c.playerLevel[3] = c.getPA().getLevelForXP(c.playerXP[3]);
    				c.getPA().refreshSkill(3);
    				c.master = 1;
    			}
    You should also make a message to tell non donar status players that they must be a donator to use the command.

    eg.

    Code:
    			if (playerCommand.startsWith("master")  && c.isDonator == 0) {
    				c.sendMessage("Only donators can use ::master");
    			}
    So now when a non donar uses the command a message will appear in their chat box saying "Only donators can use ::master"

    Now for a Save token so players can only use it once and not cheat their xp and heal in combat.

    Q:What does a save token do?
    A:A save token will write in a players file if the player has used the command example as you see their height you will also see if they have used the command this is shown slightly later.

    go to:
    src/server/model/players and open Player.java

    Search for
    Code:
    public int
    Under that add...

    Code:
    	pure,
    	master,
    Now we are going to add some save tokens to tell us if they have used the command.

    Now go to:
    src/server/model/player and open PlayerSave.java

    search for

    Code:
    					} else if (token.equals("character-rights")) {
    						p.playerRights = Integer.parseInt(token2);
    Some where under there add these two save tokens.

    Code:
                        			} else if (token.equals("Used-Pure")) {
                            			p.pure = Integer.parseInt(token2);
                        			} else if (token.equals("Used-Master")) {
                            			p.master = Integer.parseInt(token2);
    The first one is for the pure command and the second one is for the master command.

    Put those tokens under a spot were you world like here is and example of a players file and what it would look like if you put it under rights.

    Code:
    [ACCOUNT]
    character-username = username
    character-password = password
    
    [CHARACTER]
    character-height = 0
    character-posx = 3094
    character-posy = 3469
    character-rights = 0
    Used-Pure = 0
    Used-Master 0
    crystal-bow-shots = 0
    skull-timer = 0
    
    magic-book = 0
    brother-info = 0	0
    brother-info = 1	0
    brother-info = 2	0
    brother-info = 3	0
    brother-info = 4	0
    brother-info = 5	0
    special-amount = 1.0
    selected-coffin = 0
    barrows-killcount = 0
    teleblock-length = 0
    pc-points = 0
    isDonator = 0
    slayerTask = 0
    taskAmount = 0
    magePoints = 0
    autoRet = 0
    barrowskillcount = 0
    flagged = false
    wave = 0
    gwkc = 0
    fightMode = 0
    void = 0	0	0	0	0
    IF you don't like how that looks move the token down or up in PlayerSave.java.

    I know this is basic please don't flame this is just made to help some kids out.

    If you get an error please post below.
    [SIGPIC]http://www.rune-server.ee/nophp/signaturepics/sigpic140127_2.gif[/SIGPIC]

    Status: ||||||||||

    My hitmarks
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Registered Member
    Joker's Avatar
    Join Date
    Nov 2009
    Age
    25
    Posts
    1,849
    Thanks given
    378
    Thanks received
    1,205
    Rep Power
    5000
    why not make the commands loop?

    Code:
                if (playerCommand.equalsIgnoreCase("master") && c.master == 0) {
                    for (int i = 0; i < 21; i++) {
                        c.playerLevel[i] = 99;
                        c.playerXP[i] = c.getPA().getXPForLevel(100);
                        c.getPA().refreshSkill(i);    
                        c.getPA().requestUpdates();
                        c.master = 1;
                    }
                }
    Code:
                if (playerCommand.startsWith("pure") && c.pure == 0) {
                    for (int i = 0; i > 1 && i < 7; i++) {
                        c.playerLevel[i] = 99;
                        c.platerXP[i] = c.getPA().getXPForLevel(100);
                        c.getPA().refreshSkill(i);
                        c.getPA().requestUpdates();
                        c.pure = 1;
                    }
                }
    this has been released already

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  4. #3  
    Registered Member

    Join Date
    Aug 2010
    Posts
    3,284
    Thanks given
    618
    Thanks received
    1,155
    Discord
    View profile
    Rep Power
    5000
    Snippet?
    Reply With Quote  
     

  5. #4  
    Donator Market Banned Market Banned

    Usaclub's Avatar
    Join Date
    Aug 2010
    Age
    25
    Posts
    512
    Thanks given
    119
    Thanks received
    37
    Rep Power
    29
    nice! thank you!

    My Vouches..
    Spoiler for Vouches:

    Quote Originally Posted by Benes View Post
    Very good!
    Quote Originally Posted by Jesper_ View Post
    Big vouch for you!!! Thanks for your auto donation system.
    Quote Originally Posted by Light View Post
    vouch, Bought summoning & extra. Went first and was done smoothly. Rep++
    Quote Originally Posted by Grim Line View Post
    Brought all of it. Very good trade very good guy
    Quote Originally Posted by HyBriDPvP View Post
    Vouch for this guy (I bought scripts and now i got my domain up and running with the WC maker (Rsps-HQ.com)) Ty!!!
    Quote Originally Posted by chri55w View Post
    vouch bought vote4cash, was done very quickly and payment went smooth
    Rep++ too
    thanks
    Quote Originally Posted by muporz View Post
    Vouch, bought vote4points $5, he even went first.
    Thanks .

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  6. #5  
    touched like seafood
    Tyluur's Avatar
    Join Date
    Jun 2010
    Age
    23
    Posts
    4,836
    Thanks given
    1,676
    Thanks received
    1,563
    Discord
    View profile
    Rep Power
    1386
    This is basic knowledge.
    [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ] (official dog of rune-server)
    Quote Originally Posted by blakeman8192 View Post
    Keep trying. Quitting is the only true failure.
    Reply With Quote  
     

  7. #6  
    Member
    Join Date
    Aug 2010
    Posts
    78
    Thanks given
    32
    Thanks received
    10
    Rep Power
    0
    Quote Originally Posted by Big Sean View Post
    This is basic
    That's the point.
    [SIGPIC]http://www.rune-server.ee/nophp/signaturepics/sigpic140127_2.gif[/SIGPIC]

    Status: ||||||||||

    My hitmarks
    Reply With Quote  
     

  8. #7  
    Registered Member
    Ninja assassin's Avatar
    Join Date
    Oct 2008
    Posts
    1,961
    Thanks given
    217
    Thanks received
    115
    Rep Power
    77
    Quote Originally Posted by Nexus View Post
    why not make the commands loop?

    Code:
                if (playerCommand.equalsIgnoreCase("master") && c.master == 0) {
                    for (int i = 0; i < 21; i++) {
                        c.playerLevel[i] = 99;
                        c.playerXP[i] = c.getPA().getXPForLevel(100);
                        c.getPA().refreshSkill(i);    
                        c.getPA().requestUpdates();
                        c.master = 1;
                    }
                }
    Code:
                if (playerCommand.startsWith("pure") && c.pure == 0) {
                    for (int i = 0; i > 1 && i < 7; i++) {
                        c.playerLevel[i] = 99;
                        c.platerXP[i] = c.getPA().getXPForLevel(100);
                        c.getPA().refreshSkill(i);
                        c.getPA().requestUpdates();
                        c.pure = 1;
                    }
                }
    this has been released already
    you
    Btc: 1tpWTbAznzWYh6YpoUJeQ3MDVK56GGJ
    Reply With Quote  
     

  9. #8  
    Registered Member
    TORONTO's Avatar
    Join Date
    Feb 2010
    Age
    27
    Posts
    873
    Thanks given
    348
    Thanks received
    212
    Rep Power
    92
    Why have 2 seperate tokens? You can have different numerical values for each situation.
    For example Make a token called statsChange or whatever, and use some integers this way..

    Pure Only = 1
    Master Only = 2
    Pure and master = 3


    Quote Originally Posted by Nexus View Post
    why not make the commands loop?

    Code:
                if (playerCommand.equalsIgnoreCase("master") && c.master == 0) {
                    for (int i = 0; i < 21; i++) {
                        c.playerLevel[i] = 99;
                        c.playerXP[i] = c.getPA().getXPForLevel(100);
                        c.getPA().refreshSkill(i);    
                        c.getPA().requestUpdates();
                        c.master = 1;
                    }
                }
    Code:
                if (playerCommand.startsWith("pure") && c.pure == 0) {
                    for (int i = 0; i > 1 && i < 7; i++) {
                        c.playerLevel[i] = 99;
                        c.platerXP[i] = c.getPA().getXPForLevel(100);
                        c.getPA().refreshSkill(i);
                        c.getPA().requestUpdates();
                        c.pure = 1;
                    }
                }
    this has been released already
    You make me
    If you are going to make them loop how would it work? Please explain, and keep in mind that the user is selecting one of the group of skills. And seriously man, what difference would it make? Atleast it works? I doubt there is any need to worry about optimization here,
    retired from RSPS for good

    EDIT:
    I came back one last time just to thank this post:
    [SPOIL]
    [/SPOIL]
    Reply With Quote  
     

  10. #9  
    Registered Member King solona's Avatar
    Join Date
    May 2011
    Age
    23
    Posts
    24
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    Gj. Helped me
    Professional Troll
    Reply With Quote  
     

  11. #10  
    Banned

    Join Date
    Mar 2011
    Posts
    4,064
    Thanks given
    194
    Thanks received
    689
    Rep Power
    0
    Quote Originally Posted by Ramatronics View Post
    Why have 2 seperate tokens? You can have different numerical values for each situation.
    For example Make a token called statsChange or whatever, and use some integers this way..

    Pure Only = 1
    Master Only = 2
    Pure and master = 3




    You make me
    If you are going to make them loop how would it work? Please explain, and keep in mind that the user is selecting one of the group of skills. And seriously man, what difference would it make? Atleast it works? I doubt there is any need to worry about optimization here,
    lol hes looping the number of skills,it would work lol
    Reply With Quote  
     

Page 1 of 3 123 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 18
    Last Post: 08-20-2010, 08:03 AM
  2. 508 Command Loading [Noob Friendly]
    By Nikita in forum Snippets
    Replies: 22
    Last Post: 02-09-2010, 10:54 PM
  3. [NOOB TUT] How To Add Your Own Master Command
    By .Hitten in forum Snippets
    Replies: 18
    Last Post: 08-04-2009, 09:49 AM
  4. Shutdown server with a command!! (NOOB FRIENDLY!!)
    By andrew121 in forum Tutorials
    Replies: 17
    Last Post: 07-30-2008, 03:22 AM
  5. Command Handler (NOT NOOB FRIENDLY!)
    By P I M P 3 D Tut in forum Tutorials
    Replies: 4
    Last Post: 08-10-2007, 08:39 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •