Thread: Get Items from an Npc

Results 1 to 8 of 8
  1. #1 Get Items from an Npc 
    Donator

    Join Date
    May 2010
    Posts
    321
    Thanks given
    25
    Thanks received
    25
    Rep Power
    13
    I've added an NPC to my PI source, that is meant to distribute runes, arrows, and food, while taking away a specific amount of cash. The code is:

    if (c.teleAction == 7 && c.getItems().playerHasItem(995,2000000)) {
    c.getItems().addItem(555,6000);
    c.getItems().addItem(560,4000);
    c.getItems().addItem(565,2000);
    c.getItems().removeItem(995,2000000);

    It give the player runes, but does not delete cash. Help please.
    Reply With Quote  
     

  2. #2  
    Registered Member
    .Dan's Avatar
    Join Date
    Sep 2008
    Age
    28
    Posts
    873
    Thanks given
    54
    Thanks received
    115
    Rep Power
    494
    Quote Originally Posted by G3t Owned View Post
    I've added an NPC to my PI source, that is meant to distribute runes, arrows, and food, while taking away a specific amount of cash. The code is:

    if (c.teleAction == 7 && c.getItems().playerHasItem(995,2000000)) {
    c.getItems().addItem(555,6000);
    c.getItems().addItem(560,4000);
    c.getItems().addItem(565,2000);
    c.getItems().removeItem(565,2000000);

    It give the player runes, but does not delete cash. Help please.
    Did you even tried to look again at the code?
    c.getItems().removeItem(565,2000000);

    995 = money
    565 = a rune... (blood, death or water, can't remember)

    Spoiler for If you are too stupid look here:
    CHANGE 565 WITH 995
    Reply With Quote  
     

  3. #3  
    Donator

    Join Date
    May 2010
    Posts
    321
    Thanks given
    25
    Thanks received
    25
    Rep Power
    13
    Sorry, there are four options and I made that mistake for that one, but the others still don't work.
    Reply With Quote  
     

  4. #4  
    Registered Member
    .Dan's Avatar
    Join Date
    Sep 2008
    Age
    28
    Posts
    873
    Thanks given
    54
    Thanks received
    115
    Rep Power
    494
    Quote Originally Posted by G3t Owned View Post
    Sorry, there are four options and I made that mistake for that one, but the others still don't work.
    Sorry, I'm an idiot, the right method is "deleteItem", not "removeItem".

    Code:
    void deleteItem(int id, int amount)
    Reply With Quote  
     

  5. #5  
    Donator

    Join Date
    May 2010
    Posts
    321
    Thanks given
    25
    Thanks received
    25
    Rep Power
    13
    It kinda worked, but it deleted all of my cash, not just 2m
    Reply With Quote  
     

  6. #6  
    Donator

    Join Date
    May 2010
    Posts
    321
    Thanks given
    25
    Thanks received
    25
    Rep Power
    13
    Any suggestions?
    Reply With Quote  
     

  7. #7  
    Super Donator


    Join Date
    Mar 2009
    Age
    28
    Posts
    1,388
    Thanks given
    316
    Thanks received
    408
    Rep Power
    608
    Code:
    if (c.teleAction == 7){ 
    	if(c.getItems().playerHasItem(995,2000000)) {
    		c.getItems().removeItem(995,2000000);
    		c.getItems().addItem(555,6000);	
    		c.getItems().addItem(560,4000);	
    		c.getItems().addItem(565,2000);
    	}
    }
    Reply With Quote  
     

  8. #8  
    Donator

    Join Date
    May 2010
    Posts
    321
    Thanks given
    25
    Thanks received
    25
    Rep Power
    13
    Thanks
    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

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