make it so when you drop stuff it just deletes itself....
|
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.
make it so when you drop stuff it just deletes itself....
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>();
When you add a item on a ground you should add them to your list like thisCode:public static boolean contains(int id) { for(Integer item : groundItems) { if(item == null) return false; if(item == id) { return true; } } return false; }
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.
Synchronize the pickup method? Since each client has it's own thread...
Might work,
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |