Thread: Duping items on floor

Results 1 to 3 of 3
  1. #1 Duping items on floor 
    Registered Member
    Join Date
    Sep 2008
    Posts
    144
    Thanks given
    0
    Thanks received
    2
    Rep Power
    1
    my boolean additem
    public boolean addItem(int item, int amount) {
    try {
    if(item == -1)
    return false;
    if (!Item.itemStackable[item] || amount < 1) {
    amount = 1;
    }

    if ((freeSlots() >= amount && !Item.itemStackable[item]) || freeSlots() > 0) {
    for (int i = 0; i < playerItems.length; i++) {
    if (playerItems[i] == (item+1) && Item.itemStackable[item] && playerItems[i] > 0) {
    playerItems[i] = (item + 1);
    if ((playerItemsN[i] + amount) < maxItemAmount && (playerItemsN[i] + amount) > -1) {
    playerItemsN[i] += amount;
    } else {
    playerItemsN[i] = maxItemAmount;
    }
    outStream.createFrameVarSizeWord(34);
    outStream.writeWord(3214);
    outStream.writeByte(i);
    outStream.writeWord(playerItems[i]);
    if (playerItemsN[i] > 254) {
    outStream.writeByte(255);
    outStream.writeDWord(playerItemsN[i]);
    } else {
    outStream.writeByte(playerItemsN[i]); //amount
    }
    outStream.endFrameVarSizeWord();
    i = 30;
    return true;
    }
    }
    for (int i = 0; i < playerItems.length; i++) {
    if (playerItems[i] <= 0) {
    playerItems[i] = item+1;
    if (amount < maxItemAmount && amount > -1) {
    playerItemsN[i] = amount;
    } else {
    playerItemsN[i] = maxItemAmount;
    }
    outStream.createFrameVarSizeWord(34);
    outStream.writeWord(3214);
    outStream.writeByte(i);
    outStream.writeWord(playerItems[i]);
    if (playerItemsN[i] > 254) {
    outStream.writeByte(255);
    outStream.writeDWord(playerItemsN[i]);
    } else {
    outStream.writeByte(playerItemsN[i]); //amount
    }
    outStream.endFrameVarSizeWord();
    i = 30;
    return true;
    }
    }
    return false;
    } else {
    if (!IsBanking) {
    ItemHandler.addItem(item, absX, absY, amount, playerId, false);
    }
    sendMessage("Not enough space in your inventory.");
    return false;
    }
    } catch (Exception E) { return false; }
    }







    When i added the new one ^ above
    whenever you gotten a new item and you dont have space for it it would show on the floor and
    if your inv. space was full and you pickup up 1 item item on the floor it will spawn an extra one on the floor


    if (!IsBanking) {
    ItemHandler.addItem(item, absX, absY, amount, playerId, false);
    }
    in this part of the code
    when i comment out the
    ItemHandler.addItem(item, absX, absY, amount, playerId, false);
    it doesnt dupe anymore and if i spawn some stuff the spawned item doesnt shows up on the floor anymore
    Reply With Quote  
     

  2. #2  
    Donator


    Join Date
    Jan 2010
    Age
    29
    Posts
    4,122
    Thanks given
    274
    Thanks received
    551
    Rep Power
    738
    u did the tut right of invenoty full item on floor?
    Reply With Quote  
     

  3. #3  
    Registered Member
    PSNB's Avatar
    Join Date
    Aug 2009
    Posts
    885
    Thanks given
    8
    Thanks received
    103
    Rep Power
    590
    I would try to help, but I can't be arsed to try to read such a poorly written piece of shit.

    - It's inconsistent
    - There is absolutely no indentation
    - I can't tell where brackets match up

    etc, etc, etc.
    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
  •