Woot first post,
Looks good, Ill check it out
|
Well its simple but it works good.
It prevents players from buying set items from all shops. You can set player rights level, certain XP to buy, or even premium.
Right lets get started:
Step 1:
It should look somethings like this:Code:Find: deleteItem(995, GetItemSlot(995), TotPrice2);
Replace that whole code with:Code:if (playerItemsN[Slot] >= TotPrice2) { if (freeSlots() > 0) { 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("you need more space."); break; } } else { sendMessage("You don't have enough coins."); break; }
You see where it has if(itemID == 773 && playerRights <= 1) {Code:if (playerItemsN[Slot] >= TotPrice2) { if (freeSlots() > 0) { if(itemID == 773 && playerRights <= 1) { sendMessage("You can't purchase this item!"); } 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("you need more space."); break; } } else { sendMessage("You don't have enough coins."); break; }
thats where you enter the items which you whish to block.
So if you want to block whip, blue party hat, and 'perfect ring' from being purchased by non-staff members, your code would look like this:
Also you could if you wanted set your untradable int to connect through that code.Code:if(itemID == 773 || itemID == 4151 || itemID == 1038 && playerRights <= 1) {
Well don't flame or you can gtfo.
You can use this for blocking buying from whole shops also, good job.
leeched.
I knows it o.O
Unless you can proove, and provide evidence, then its not noob, so stop flaming.
__________________________________________________ _____________
Tested, and it works great!!! . .... Here is the code for delta, for anyone who wants it!
Code:if (playerItemsN[Slot] >= TotPrice2) { if (freeSlots() > 0) { if(itemID == 773 || itemID == 4151 || itemID == 1038 && playerRights <= 1) { sM("You can't purchase this item!"); } 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 { sM("you need more space."); break; } } else { sM("You don't have enough coins."); break; }
Or just do this.
return; will stop the method wherever it is and not execute anything after. Your shopID and itemID go in there accordingly.Code:if (playerRights == 2 && MyShopID == 1) { Send("You can has FAIL for breakfast"); return; } if (!donator && itemID == 2300) { Send("Bullshit"); return; }
If your buy method is a boolean "public boolean buyItem(int itemID, int fromSlot, int amount)" then change "return" to "return false"
This is all well and good, but who really still has admin only items? isnt that kinda lame?
but premium, i guess.
ErmWon't work... I'm sure. Make itCode:if(itemID == 773 || itemID == 4151 || itemID == 1038 && playerRights <= 1) {
if(itemID == 773 && playerRights <= 1 || itemID == 4151 && playerRights <= 1 || itemID == 1038 && playerRights <= 1) {
+This is rly stupid =P... why put admin items in shop , they can spawn lol
His code is almost there, yours is just fail.
Notice the extra ( ). This means any of those items AND player rights. Before it was just the last item and admin rights, NO ONE could buy the first two.Code:if((itemID == 773 || itemID == 4151 || itemID == 1038) && playerRights <= 1) {
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |