I tried this tut: http://www.rune-server.org/showthread.php?t=87390
Followed all directions, but it didn't work. Here are my codes
Buyitem method:
Code:
public boolean buyItem(int itemID, int fromSlot, int amount) {
if (amount > 0 && itemID == (server.shopHandler.ShopItems[MyShopID][fromSlot]-1)) {
if (amount > server.shopHandler.ShopItemsN[MyShopID][fromSlot]) {
amount = server.shopHandler.ShopItemsN[MyShopID][fromSlot];
}
double ShopValue;
double TotPrice;
int TotPrice2;
int Overstock;
int Slot = 0;
int Slot2 = 0;
if (!canUse(itemID)) {
sendMessage("You must be a premium member to buy this item");
return false;
}
for (int i = amount; i > 0; i--) {
TotPrice2 = (int)Math.floor(GetItemShopValue(itemID, 0, fromSlot));
if (MyShopID == 70) {
Slot = GetItemSlot(2996);
} else {
Slot = GetItemSlot(995);
}
if (Slot == -1) {
if (MyShopID == 6) {
sendMessage("You don't have enough CHANGE HAME HERE");
break;
} else {
sendMessage("You don't have enough coins.");
break;
}
}
if (playerItemsN[Slot] >= TotPrice2) {
if (freeSlots() > 0) {
if (MyShopID == 6) {
deleteItem(2996, GetItemSlot(2996), TotPrice2);
} else {
deleteItem(995, GetItemSlot(995), TotPrice2);
}
addItem(itemID, 1);
server.shopHandler.ShopItemsN[MyShopID][fromSlot] -= 1;
server.shopHandler.ShopItemsDelay[MyShopID][fromSlot] = 0;
if ((fromSlot+1) > server.shopHandler.ShopItemsStandard[MyShopID]) {
server.shopHandler.ShopItems[MyShopID][fromSlot] = 0;
}
} else {
sendMessage("Not enough space in your inventory.");
break;
}
} else {
if (MyShopID == 6) {
sendMessage("You don't have enough NAME HERE OF THE ITEM");
} else {
sendMessage("You don't have enough coins.");
}
break;
}
}
resetItems(3823);
resetShop(MyShopID);
UpdatePlayerShop();
return true;
}
return false;
}
Selling void:
Code:
public boolean sellItem(int itemID, int fromSlot, int amount) {
if ((amount > 0) && (itemID == (playerItems[fromSlot] - 1))) {
if (server.shopHandler.ShopSModifier[MyShopID] > 1) {
boolean IsIn = false;
for (int i = 0; i <= server.shopHandler.ShopItemsStandard[MyShopID]; i++) {
if (itemID == (server.shopHandler.ShopItems[MyShopID][i] - 1)) {
IsIn = true;
break;
}
}
if (IsIn == false) {
sendMessage("You cannot sell " + getItemName(itemID)
+ " in this store.");
return false;
}
}
if (Item.itemSellable[(playerItems[fromSlot] - 1)] == false) {
sendMessage("I cannot sell " + getItemName(itemID) + ".");
return false;
}
if ((amount > playerItemsN[fromSlot])
&& ((Item.itemIsNote[(playerItems[fromSlot] - 1)] == true) || (Item.itemStackable[(playerItems[fromSlot] - 1)] == true))) {
amount = playerItemsN[fromSlot];
} else if ((amount > GetXItemsInBag(itemID))
&& (Item.itemIsNote[(playerItems[fromSlot] - 1)] == false)
&& (Item.itemStackable[(playerItems[fromSlot] - 1)] == false)) {
amount = GetXItemsInBag(itemID);
}
double ShopValue;
double TotPrice;
int TotPrice2;
int Overstock;
for (int i = amount; i > 0; i--) {
TotPrice2 = (int)Math.floor(GetItemShopValue(itemID, 1, fromSlot));
if (freeSlots() > 0) {
if (Item.itemIsNote[itemID] == false) {
deleteItem(itemID, GetItemSlot(itemID), 1);
} else {
deleteItem(itemID, fromSlot, 1);
}
if (MyShopID == 6) {
addItem(2996, TotPrice2);
addShopItem(itemID, 1);
} else {
addItem(995, TotPrice2);
addShopItem(itemID, 1);
}
} else {
sendMessage("Not enough space in your inventory.");
break;
}
}
resetItems(3823);
resetShop(MyShopID);
UpdatePlayerShop();
return true;
}
return true;
}
help please!