Thread: Advise needed on a way to fix a common drop dupe.

Results 1 to 5 of 5
  1. #1 Advise needed on a way to fix a common drop dupe. 
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    Well,

    It has come to my attention there is a drop duplication glitch in most server source's, this one being a drop dupe.

    If a user drop's a items...Waits for it to appear and two users at the exact same time, do the pickup they both get it...

    I have thought about this quite abit to no avail, any advise on how I could go about fixing this duplication glitch?

    Oh before you say its a lack of system performance ("its not deleting the item quick enough"), it's not the server.

    This dupe works very well on 2speced aswell... just so you know tyler.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Nuevo's Avatar
    Join Date
    Jul 2008
    Posts
    647
    Thanks given
    7
    Thanks received
    13
    Rep Power
    169
    make it so when you drop stuff it just deletes itself....
    Reply With Quote  
     

  3. #3  
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    Quote Originally Posted by Livengood View Post
    make it so when you drop stuff it just deletes itself....
    No... because that would be the object to alot of thing's.
    Reply With Quote  
     

  4. #4  
    Registered Member
    Kelvin's Avatar
    Join Date
    Jun 2007
    Posts
    1,433
    Thanks given
    48
    Thanks received
    33
    Rep Power
    269
    Put your drops in a list
    if someone takes the drop it remove the item from the list
    you can check if the item in a list is a null means that the item is invalid/has been taken bij someone.

    ill give you a short snippet

    private static List<Integer> groundItems = new ArrayList<Integer>();

    Code:
     
        public static boolean contains(int id) {
            for(Integer item : groundItems) {
                 if(item == null) 
                 return false;
    
                 if(item == id) {
                    return true;
                 }
            }
            return false;
        }
    When you add a item on a ground you should add them to your list like this
    groundItems.add(itemID);

    to check if a item is in the grounditem list use if(contains(id)) {
    and when someone takes a drop you need to
    groundItems.remove(itemID);
    so it will remove it from your list.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Deadly Uzi's Avatar
    Join Date
    Jul 2008
    Posts
    994
    Thanks given
    177
    Thanks received
    87
    Rep Power
    362
    Synchronize the pickup method? Since each client has it's own thread...

    Might work,
    Attempting to develop a multi-revision library. See it on GitHub.
    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
  •