Thread: [317PI] Help

Results 1 to 4 of 4
  1. #1 [317PI] Help 
    Catherby Developer
    Mini Slurpee's Avatar
    Join Date
    Apr 2011
    Posts
    747
    Thanks given
    80
    Thanks received
    86
    Rep Power
    31
    When a player tries to reset his att,def,or pray, it costs 2.5m , but it takes all their money that they have even if they have 200m+ it'll take it all.. i don't understand the code tells to take away 2.5m .?
    Code:
    int coins = 995;
    		int amount = 2500000;
                int npcType = 1060; //resetdef
                if (c.dialogueAction == 42) {
                    if (c.inWild())
                        return;
                    if (!c.getItems().playerHasItem(coins, amount)) {
                        c.sendMessage("@red@You need 2,500,000 coins to reset your defence.");
                        c.getPA().closeAllWindows();
                        return;
                    }
                    for (int j = 0; j < c.playerEquipment.length; j++) {
                        if (c.playerEquipment[j] > 0) {
                            c.sendMessage("@red@Please remove your armour before doing this");
                            c.getPA().closeAllWindows();
                            c.getDH().sendDialogues(420, npcType);
                            return;
                        }
                    }
    
                    try {
    		    c.getItems().deleteItem(995, 2500000);
                        int skilld = 1;
                        int leveld = 1;
                        c.playerXP[skilld] = c.getPA().getXPForLevel(leveld) + 5;
                        c.playerLevel[skilld] = c.getPA().getLevelForXP(c.playerXP[skilld]);
                        c.getPA().refreshSkill(skilld);
                        c.getDH().sendDialogues(230, npcType);
                    } catch (Exception e) {}
                }
    Attached image
    “I have not failed, I've just found 10,000 ways that won't work.”
    “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Jun 2012
    Posts
    78
    Thanks given
    0
    Thanks received
    4
    Rep Power
    12
    [EDITED] you might have those ints already reading at a high number. just do it this way
    You made that more difficult than needed be.
    something like this:
    Code:
    if (c.dialogueAction == 42) {
                    if (c.inWild()){
                        return;
    				for (int j = 0; j < c.playerEquipment.length; j++) {
    					if (!c.playerEquipment[j] >0) {
    					c.sendMessage("@red@Please remove your armour before doing this");
    					return;
    					}
                    if (c.getItems().playerHasItem(995, 2500000)) {
    					c.getItems().deleteItem(995, 2500000);
                        int skilld = 1;
                        int leveld = 1;
                        c.playerXP[skilld] = c.getPA().getXPForLevel(leveld) + 5;
                        c.playerLevel[skilld] = c.getPA().getLevelForXP(c.playerXP[skilld]);
                        c.getPA().refreshSkill(skilld);
                        c.getDH().sendDialogues(230, npcType);
                    }
    				}
    				}
                    } else {
    						c.sendMessage("@red@You need 2,500,000 coins to reset your defence.");
                            c.getPA().closeAllWindows();
                            c.getDH().sendDialogues(420, npcType);
                            return;
                        }
                    }
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    May 2013
    Posts
    1,169
    Thanks given
    28
    Thanks received
    133
    Rep Power
    53
    Didn't look at what you posted, but I'm pretty sure this problem deals with your deleteItem method.
    Go to your itemassistants class and find your deleteItem method, replace it with this:

    Code:
                  	public void deleteItem(int id, int amount) {
    		deleteItem(id, getItemSlot(id), amount);
    	}
    If only I hadn't given you up, my life could've been different.
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Jan 2013
    Posts
    583
    Thanks given
    343
    Thanks received
    146
    Rep Power
    163
    add a 0 to the end of int amount

    I don't know what you heard about me
    But a pleb can't get a rep out of me
    No rep, no thanks, you can't see
    That I'm a mother****ing P - I - M - P

    Cool Cats
    Thakiller 🎺 Scu11 🎸 Tyler 🎷 Lare 🎤 ur nan
    Reply With Quote  
     


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. 317PI Runecrafting interface [HELP]
    By Mr Torva in forum Help
    Replies: 0
    Last Post: 03-31-2012, 02:46 AM
  2. 317PI Achievement help
    By Mr Torva in forum Help
    Replies: 0
    Last Post: 03-30-2012, 12:06 AM
  3. Need gfx help?
    By Beh3moth2 in forum General
    Replies: 1
    Last Post: 04-03-2007, 11:50 AM
  4. Need help again
    By Zane in forum Showcase
    Replies: 4
    Last Post: 04-02-2007, 09:11 PM
  5. Need help choosing sig
    By Zane in forum Showcase
    Replies: 7
    Last Post: 04-02-2007, 03:14 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •