Thread: Pkpoints into currency

Results 1 to 6 of 6
  1. #1 Pkpoints into currency 
    ⚓Manic-Owner⚓


    Join Date
    Nov 2007
    Posts
    2,711
    Thanks given
    47
    Thanks received
    9
    Rep Power
    650
    Here's my code.

    Code:
    if(NPCID == 276){
    if(pkpoints > 1) {
    addItem(6529, pkpoints);
    pkpoints = 0;
    sM("You recieve the number of pkpoints you had in a currency form.");
    sM("Remember, 'currency form' is only for use in trading other players.");
    } else {
    if (playerHasItem(6529)) {
    pkpoints = amountOfItem(6529);
    deleteItem(6529, 999999999);
    sM("Your pkpoints have been converted back into non-currency form.");
    sM("You can now exchange pkpoints with npcs but not players.");
    }
    }
    }
    The part of my code not working is this.
    Code:
    if (playerHasItem(6529)) {
    pkpoints = amountOfItem(6529);
    deleteItem(6529, 999999999);
    sM("Your pkpoints have been converted back into non-currency form.");
    sM("You can now exchange pkpoints with npcs but not players.");
    }
    It doesn't give me the proper amount of pkpoints, it only gives me 1, please help? And yes I'm using delta.
    MY DISCORD:
    bluejay#1504
    Reply With Quote  
     

  2. #2  
    Registered Member
    Chiief's Avatar
    Join Date
    Jun 2010
    Posts
    1,544
    Thanks given
    69
    Thanks received
    238
    Rep Power
    611
    Post your amountOfItem method?
    Reply With Quote  
     

  3. #3  
    ⚓Manic-Owner⚓


    Join Date
    Nov 2007
    Posts
    2,711
    Thanks given
    47
    Thanks received
    9
    Rep Power
    650
    public int amountOfItem(int itemID) {
    int i1 = 0;

    for (int i = 0; i < 28; i++) {
    if (playerItems[i] == (itemID + 1)) {
    i1++;
    }
    }
    return i1;
    }
    MY DISCORD:
    bluejay#1504
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Aug 2008
    Posts
    2,823
    Thanks given
    362
    Thanks received
    448
    Rep Power
    965
    That code only works for unstackables, I'll get you one that works for stackables also
    Reply With Quote  
     

  5. #5  
    Registered Member

    Join Date
    Aug 2008
    Posts
    2,823
    Thanks given
    362
    Thanks received
    448
    Rep Power
    965
    Try this:
    Code:
    public boolean HasItemAmount(int itemID, int itemAmount) {
        int playerItemAmountCount = 0;
        for (int i=0; i<playerItems.length; i++) {
            if (playerItems[i] == itemID+1) {
                playerItemAmountCount = playerItemsN[i];
            }
            if(playerItemAmountCount >= itemAmount){
                return true;
            }
        }
        return false;
    }
    Reply With Quote  
     

  6. #6  
    ⚓Manic-Owner⚓


    Join Date
    Nov 2007
    Posts
    2,711
    Thanks given
    47
    Thanks received
    9
    Rep Power
    650
    ooo now i know why thank you rep++
    MY DISCORD:
    bluejay#1504
    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
  •