Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tradeGold(goldAmount, itemId, itemAmount, itemDamage) {
- //your code (add item and remove the gold)
- var playerGoldAmount;
- for(var i = 0; i <= 36; i++) {
- if(Player.getInventorySlot(i) == 266) {
- playerGoldAmount = playerGoldAmount + Player.getInventorySlotCount(i);
- }
- }
- if(playerGoldAmount >= goldAmount) {
- Player.addItemInventory(266, -goldAmount, 0);
- Player.addItemInventory(itemId, itemAmount, itemDamage);
- } else {
- clientMessage(ChatColor.RED + "You need " + Math.floor(goldAmount - playerGoldAmount) + " more gold to trade!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement