Thread: Max stand allows everyone to buy?

Results 1 to 3 of 3
  1. #1 Max stand allows everyone to buy? 
    Banned
    Join Date
    Oct 2014
    Posts
    638
    Thanks given
    74
    Thanks received
    54
    Rep Power
    0
    Alright so I got a dialogue for max cape stand. Everything works except, anyone can buy the cape, for some reason the requirements dont work.

    Heres the whole dialogue script:

    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.Settings;
    import com.rs.cache.loaders.ObjectDefinitions;
    import com.rs.cores.CoresManager;
    import com.rs.game.Animation;
    import com.rs.game.ForceMovement;
    import com.rs.game.Entity;
    import com.rs.game.Graphics;
    import com.rs.game.Hit;
    import com.rs.game.World;
    import com.rs.game.WorldObject;
    import com.rs.game.WorldTile;
    import com.rs.game.item.FloorItem;
    import com.rs.game.item.Item;
    import com.rs.game.player.content.*;
    import com.rs.game.player.Skills;
    import com.rs.game.tasks.WorldTask;
    import com.rs.game.tasks.WorldTasksManager;
    import com.rs.net.Session;
    import com.rs.net.decoders.WorldPacketsDecoder;
    import com.rs.net.encoders.WorldPacketsEncoder;
    import com.rs.utils.*;
    import com.rs.utils.Logger;
    import com.rs.utils.SerializableFilesManager;
    import com.rs.utils.Utils;
    
    public final class MaxCapeStand extends Dialogue {
    
    	@Override
    	public void start() {
    		sendEntityDialogue(SEND_1_TEXT_CHAT,
    				new String[] { player.getDisplayName(), //This grabs your name and puts it at the top of the chat representing you talking to the npc
                                                                    "It's the Max Cape Stand!" }, IS_PLAYER, //Watch your language!
                                                    player.getIndex(), 9827);
    	}
    
    	@Override
    	public void run(int interfaceId, int componentId) {
    		if (stage == -1) {
    			stage = 0;
    			sendDialogue(SEND_2_OPTIONS,
    					"Buy a Max Cape for 5m?",
    					"Yes!", "No.");
    		} else if (stage == 0) {
    			if (componentId == 1) {
                if (player.getInventory().containsItem(995, 5000000)) {
    			player.getInventory().deleteItem(995, 5000000);
    			player.getInventory().addItem(20767, 1);
    			player.getInventory().addItem(20768, 1);
    			player.getPackets().sendGameMessage(
                                        "<col=04B404>You just purchased a Max Cape!");
    			player.setNextAnimation(new Animation(2109));
    			
    			}
    				end();
    					}
    			end();
    		}
    
    	}
    
    	@Override
    	public void finish() {
    		// TODO Auto-generated method stub
    
    	}
    
    }
    Please help, its a 667.
    Reply With Quote  
     

  2. #2  
    Registered Member
    hc747's Avatar
    Join Date
    Dec 2013
    Age
    26
    Posts
    1,474
    Thanks given
    3,312
    Thanks received
    691
    Rep Power
    1098
    ..?
    The only 'requirement' that you're checking is if the player has 5,000,000 coins. According to the code, it works fine. ;-;

    in the player class. (Change 25 to the amount of skills your server / revision has +1)
    Code:
    public boolean isMaxed() {       
     for (int i = 0; i < 25; i++)
                if (getSkills().getLevel(i) < 99)
                    return false;
            return true;
        }
    Under if (stage == -1) {
    Code:
    if (!player.isMaxed()) {
    player.getPackets().sendGameMessage("You need to be maxed to do this!");
    end();
    return;
    }
    This would have been easy for you to figure out, if you actually read the code.

    Edit: also remove unnecessary imports;
    This:
    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.Settings;
    import com.rs.cache.loaders.ObjectDefinitions;
    import com.rs.cores.CoresManager;
    import com.rs.game.Animation;
    import com.rs.game.ForceMovement;
    import com.rs.game.Entity;
    import com.rs.game.Graphics;
    import com.rs.game.Hit;
    import com.rs.game.World;
    import com.rs.game.WorldObject;
    import com.rs.game.WorldTile;
    import com.rs.game.item.FloorItem;
    import com.rs.game.item.Item;
    import com.rs.game.player.content.*;
    import com.rs.game.player.Skills;
    import com.rs.game.tasks.WorldTask;
    import com.rs.game.tasks.WorldTasksManager;
    import com.rs.net.Session;
    import com.rs.net.decoders.WorldPacketsDecoder;
    import com.rs.net.encoders.WorldPacketsEncoder;
    import com.rs.utils.*;
    import com.rs.utils.Logger;
    import com.rs.utils.SerializableFilesManager;
    import com.rs.utils.Utils;
    can be changed to this:
    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.game.Animation;
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Banned
    Join Date
    Oct 2014
    Posts
    638
    Thanks given
    74
    Thanks received
    54
    Rep Power
    0
    Quote Originally Posted by hc747 View Post
    ..?
    The only 'requirement' that you're checking is if the player has 5,000,000 coins. According to the code, it works fine. ;-;

    in the player class. (Change 25 to the amount of skills your server / revision has +1)
    Code:
    public boolean isMaxed() {       
     for (int i = 0; i < 25; i++)
                if (getSkills().getLevel(i) < 99)
                    return false;
            return true;
        }
    Under if (stage == -1) {
    Code:
    if (!player.isMaxed()) {
    player.getPackets().sendGameMessage("You need to be maxed to do this!");
    end();
    return;
    }
    This would have been easy for you to figure out, if you actually read the code.

    Edit: also remove unnecessary imports;
    This:
    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.Settings;
    import com.rs.cache.loaders.ObjectDefinitions;
    import com.rs.cores.CoresManager;
    import com.rs.game.Animation;
    import com.rs.game.ForceMovement;
    import com.rs.game.Entity;
    import com.rs.game.Graphics;
    import com.rs.game.Hit;
    import com.rs.game.World;
    import com.rs.game.WorldObject;
    import com.rs.game.WorldTile;
    import com.rs.game.item.FloorItem;
    import com.rs.game.item.Item;
    import com.rs.game.player.content.*;
    import com.rs.game.player.Skills;
    import com.rs.game.tasks.WorldTask;
    import com.rs.game.tasks.WorldTasksManager;
    import com.rs.net.Session;
    import com.rs.net.decoders.WorldPacketsDecoder;
    import com.rs.net.encoders.WorldPacketsEncoder;
    import com.rs.utils.*;
    import com.rs.utils.Logger;
    import com.rs.utils.SerializableFilesManager;
    import com.rs.utils.Utils;
    can be changed to this:
    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.game.Animation;
    Worked, tyvm!
    I didn't make the dialogue, no idea why there was so many imports lol
    Reply With Quote  
     

  5. Thankful user:



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: 17
    Last Post: 09-24-2014, 02:45 AM
  2. Replies: 0
    Last Post: 09-18-2011, 08:17 AM
  3. Replies: 4
    Last Post: 09-13-2011, 03:18 PM
  4. Only allowing testers to connect
    By PeeHPee in forum Tutorials
    Replies: 19
    Last Post: 12-08-2007, 10:15 PM
  5. Replies: 1
    Last Post: 11-20-2007, 06:00 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •