Bump
|
Hello guys, I've recently added something so when you die in pvp with chaotics, they drop to coins ( in fact i wanted them untradeable)
Since then, all 'untradeables' have been just disapearing exept the chaotics, even in pvm which is the annoying part.
I've added an other "else if" for thoses untradeables, and in my config.java, chaotics and untradeables are two different things
Still doesn't work, can anyone check into this or make it cleaner?
ThanksCode:public void dropAllItems() { Client o = (Client) Server.playerHandler.players[c.killerId]; if (c.playerRights == 3/*|| c.isInArd() || c.isInFala()*/){ return; } for(int i = 0; i < c.playerItems.length; i++) { if(o != null) { if (tradeable(c.playerItems[i] - 1)) { Server.itemHandler.createGroundItem(o, c.playerItems[i] -1, c.getX(), c.getY(), c.playerItemsN[i], c.killerId); } else { if (pvp(c.playerItems[i] - 1)) Server.itemHandler.createGroundItem(o, 995, c.getX(), c.getY(), getPvpPrice(c.playerItems[i]-1), c.killerId); } } else { if (untradeable(c.playerItems[i] - 1)) Server.itemHandler.createGroundItem(c, c.playerItems[i] -1, c.getX(), c.getY(), c.playerItemsN[i], c.playerId); } } for(int e = 0; e < c.playerEquipment.length; e++) { if(o != null) { if (tradeable(c.playerEquipment[e])) { Server.itemHandler.createGroundItem(o, c.playerEquipment[e], c.getX(), c.getY(), c.playerEquipmentN[e], c.killerId); } else { if (pvp(c.playerEquipment[e])) Server.itemHandler.createGroundItem(o, 995, c.getX(), c.getY(), getPvpPrice(c.playerEquipment[e]), c.killerId); } } else { if (untradeable(c.playerItems[e])) Server.itemHandler.createGroundItem(c, c.playerEquipment[e], c.getX(), c.getY(), c.playerEquipmentN[e], c.playerId); } } if(o != null) { Server.itemHandler.createGroundItem(o, 526, c.getX(), c.getY(), 1, c.killerId); } } public int getPvpPrice(int item) { switch (item) { case 18349: case 18351: case 18353: case 18355: case 18357: case 18359: case 18361: case 18363: return 100000000; } return 0; } public boolean tradeable(int itemId) { for (int j = 0; j < Config.ITEM_TRADEABLE.length; j++) { if (itemId == Config.ITEM_TRADEABLE[j]) return false; } return true; } public boolean untradeable(int itemId) { for (int j = 0; j < Config.ITEM_TRADEABLE.length; j++) { if (itemId == Config.ITEM_TRADEABLE[j]) return true; } return false; } public boolean pvp(int itemId) { for (int j = 0; j < Config.ITEM_PVP.length; j++) { if (itemId == Config.ITEM_PVP[j]) return true; } return false; }
make a backup and then try this...
let me know if there are any errors or if it doesn't work, i didn't and can't test it (i also did it in notepad...)
Code:public void dropAllItems() { Client o = (Client) Server.playerHandler.players[c.killerId]; if (c.playerRights == 3){ return; //we are not dropping items for admins } for(int i = 0; i < c.playerItems.length; i++) { if(o != null) { if (tradeable(c.playerItems[i] - 1)) { Server.itemHandler.createGroundItem(o, c.playerItems[i] -1, c.getX(), c.getY(), c.playerItemsN[i], c.killerId); } else { if (pvp(c.playerItems[i] - 1)) Server.itemHandler.createGroundItem(o, 995, c.getX(), c.getY(), getPvpPrice(c.playerItems[i]-1), c.killerId); } else { if (untradeable(c.playerItems[i] - 1)) Server.itemHandler.createGroundItem(c, c.playerItems[i] -1, c.getX(), c.getY(), c.playerItemsN[i], c.playerId); } } //end of for loop for(int e = 0; e < c.playerEquipment.length; e++) { if(o != null) { if (tradeable(c.playerEquipment[e])) { Server.itemHandler.createGroundItem(o, c.playerEquipment[e], c.getX(), c.getY(), c.playerEquipmentN[e], c.killerId); } else { if (pvp(c.playerEquipment[e])) Server.itemHandler.createGroundItem(o, 995, c.getX(), c.getY(), getPvpPrice(c.playerEquipment[e]), c.killerId); } else { if (untradeable(c.playerItems[e])) Server.itemHandler.createGroundItem(c, c.playerEquipment[e], c.getX(), c.getY(), c.playerEquipmentN[e], c.playerId); } } //end of for loop if(o != null) { Server.itemHandler.createGroundItem(o, 526, c.getX(), c.getY(), 1, c.killerId); } } //end of dropAllItems(); public int getPvpPrice(int item) { switch (item) { case 18349: case 18351: case 18353: case 18355: case 18357: case 18359: case 18361: case 18363: return 100000000; } return 0; } public boolean tradeable(int itemId) { for (int j = 0; j < Config.ITEM_TRADEABLE.length; j++) { if (itemId == Config.ITEM_TRADEABLE[j]) return false; } return true; } public boolean untradeable(int itemId) { for (int j = 0; j < Config.ITEM_TRADEABLE.length; j++) { if (itemId == Config.ITEM_TRADEABLE[j]) return true; } return false; } public boolean pvp(int itemId) { for (int j = 0; j < Config.ITEM_PVP.length; j++) { if (itemId == Config.ITEM_PVP[j]) return true; } return false; }
try this, lemme know errors and what works/doesn't work...
i don't have a copy of your source so i can't really test and debug till it works, so i am relying on what you tell me, if that makes sense.
also can i get your "Config.ITEM_PVP"?Code:public void dropAllItems() { Client o = (Client) Server.playerHandler.players[c.killerId]; if (c.playerRights == 3){ return; //we are not dropping items for admins } //end of admin check for(int e = 0; e < c.playerEquipment.length; e++) { if(o != null) { if (tradeable(c.playerEquipment[e])) { Server.itemHandler.createGroundItem(o, c.playerEquipment[e], c.getX(), c.getY(), c.playerEquipmentN[e], c.killerId); } if (pvp(c.playerEquipment[e])) { Server.itemHandler.createGroundItem(o, 995, c.getX(), c.getY(), getPvpPrice(c.playerEquipment[e]), c.killerId); } if (untradeable(c.playerItems[e])) { Server.itemHandler.createGroundItem(c, c.playerEquipment[e], c.getX(), c.getY(), c.playerEquipmentN[e], c.playerId); } } //end of for loop } //end of dropAllItems(); switch (item) { case 18349: case 18351: case 18353: case 18355: case 18357: case 18359: case 18361: case 18363: return 100000000; } return 0; } public boolean tradeable(int itemId) { for (int j = 0; j < Config.ITEM_TRADEABLE.length; j++) { if (itemId == Config.ITEM_TRADEABLE[j]) return false; } return true; } public boolean untradeable(int itemId) { for (int j = 0; j < Config.ITEM_TRADEABLE.length; j++) { if (itemId == Config.ITEM_TRADEABLE[j]) return true; } return false; } public boolean pvp(int itemId) { for (int j = 0; j < Config.ITEM_PVP.length; j++) { if (itemId == Config.ITEM_PVP[j]) return true; } return false; }
The 'error': If the item was untradeable it would only drop if the item was a PVP item, else nothing. I also cleaned the code a bit by removing the void function 'untradeable' because it did the exactly same as the 'tradeable' function except opposite.
If you have any 'untradeable(item)' in your source you will need to change them to '!tradeable(item)'!
Here's the fix:
Code:public void dropAllItems() { Client o = (Client) Server.playerHandler.players[c.killerId]; if (c.playerRights == 3/*|| c.isInArd() || c.isInFala()*/){ return; } for(int i = 0; i < c.playerItems.length; i++) { if(o != null) { if (tradeable(c.playerItems[i] - 1)) { Server.itemHandler.createGroundItem(o, c.playerItems[i] -1, c.getX(), c.getY(), c.playerItemsN[i], c.killerId); } else { if (pvp(c.playerItems[i] - 1)) Server.itemHandler.createGroundItem(o, 995, c.getX(), c.getY(), getPvpPrice(c.playerItems[i]-1), c.killerId); else Server.itemHandler.createGroundItem(c, c.playerItems[i] -1, c.getX(), c.getY(), c.playerItemsN[i], c.playerId); } } else { if (!tradeable(c.playerItems[i] - 1)) Server.itemHandler.createGroundItem(c, c.playerItems[i] -1, c.getX(), c.getY(), c.playerItemsN[i], c.playerId); } } for(int e = 0; e < c.playerEquipment.length; e++) { if(o != null) { if (tradeable(c.playerEquipment[e])) { Server.itemHandler.createGroundItem(o, c.playerEquipment[e], c.getX(), c.getY(), c.playerEquipmentN[e], c.killerId); } else { if (pvp(c.playerEquipment[e])) Server.itemHandler.createGroundItem(o, 995, c.getX(), c.getY(), getPvpPrice(c.playerEquipment[e]), c.killerId); else Server.itemHandler.createGroundItem(c, c.playerEquipment[e], c.getX(), c.getY(), c.playerEquipmentN[e], c.playerId); } } else { if (!tradeable(c.playerItems[e])) Server.itemHandler.createGroundItem(c, c.playerEquipment[e], c.getX(), c.getY(), c.playerEquipmentN[e], c.playerId); } } if(o != null) { Server.itemHandler.createGroundItem(o, 526, c.getX(), c.getY(), 1, c.killerId); } } public int getPvpPrice(int item) { switch (item) { case 18349: case 18351: case 18353: case 18355: case 18357: case 18359: case 18361: case 18363: return 100000000; } return 0; } public boolean tradeable(int itemId) { for (int j = 0; j < Config.ITEM_TRADEABLE.length; j++) { if (itemId == Config.ITEM_TRADEABLE[j]) return false; } return true; } public boolean pvp(int itemId) { for (int j = 0; j < Config.ITEM_PVP.length; j++) { if (itemId == Config.ITEM_PVP[j]) return true; } return false; }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |