Thread: Pk Tickets Redeeming

Results 1 to 4 of 4
  1. #1 Pk Tickets Redeeming 
    Registered Member

    Join Date
    Dec 2013
    Posts
    866
    Thanks given
    121
    Thanks received
    138
    Rep Power
    107
    So I'm lost at how can the pk ticket give pk points at any amount of pk tickets they have & the part were it deletes the amount of pk tickets they have, I have a set number in there so it doesn't give me an error.


    if (itemId == 5020)
    if (c.getItems().playerHasItem(5020)) {
    c.getItems().deleteItem(5020, 1000);
    return;
    }

    my code now is, it just wears the tickets, Im pretty sure if the code works it'd probably delete it's self because of the code in it.

    Code:
    if (itemId == 5020)
    			if (c.getItems().playerHasItem(5020)) {
    			c.pkp += +amount;
    			c.getItems().deleteItem(5020, amount);
    			return;
    			}
    Reply With Quote  
     

  2. #2  
    Owner of Dawntained

    Mgt Madness's Avatar
    Join Date
    Oct 2011
    Age
    28
    Posts
    3,380
    Thanks given
    1,429
    Thanks received
    958
    Rep Power
    2168
    Use parenthesis and add debug prints to know if the code is even being executed
    Attached image
    Reply With Quote  
     

  3. #3  
    強い者は生き残る
    Ashpire's Avatar
    Join Date
    Mar 2012
    Age
    27
    Posts
    2,721
    Thanks given
    914
    Thanks received
    1,897
    Rep Power
    2231
    Not sure how PI handles it exactly but it should be something like:

    Code:
    		int amount = player.getInventory().getAmount(5020);
    		
    		player.getInventory().remove(new Item(5020, amount));
    		player.setPkPoints(player.getPkPoints() + amount);
    Attached image
    Reply With Quote  
     

  4. Thankful user:


  5. #4  
    Registered Member

    Join Date
    Dec 2013
    Posts
    866
    Thanks given
    121
    Thanks received
    138
    Rep Power
    107
    Quote Originally Posted by Play Boy View Post
    Not sure how PI handles it exactly but it should be something like:

    Code:
    		int amount = player.getInventory().getAmount(5020);
    		
    		player.getInventory().remove(new Item(5020, amount));
    		player.setPkPoints(player.getPkPoints() + amount);
    my code now is, it just wears the tickets, Im pretty sure if the code works it'd probably delete it's self because of the code in it.
    Code:
    if (itemId == 5020)
    			if (c.getItems().playerHasItem(5020)) {
    			c.getItems().deleteItem(5020, amount);
    			c.pkp += +amount;
    			return;
    			}
    Bump
    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. Replies: 276
    Last Post: 04-23-2017, 10:17 PM
  2. Help Making a Pk Ticket!
    By Kjloveday in forum Help
    Replies: 14
    Last Post: 12-23-2014, 12:47 PM
  3. Replies: 10
    Last Post: 06-15-2014, 05:47 PM
  4. [PI] Ticket Redeeming problem
    By Beanerrr in forum Help
    Replies: 13
    Last Post: 03-11-2011, 02:12 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
  •