#has money not seeming to work

1 messages · Page 1 of 1 (latest)

zinc stirrup
#

Hi, was trying to make a server shop using Deluxe menus and i got it to take money from users say it in chat the item bought, how much and display your new remaining balance but if you are too broke to afford it, you can buy it anyway, i tried usine the "has money" requirement but to no affect
Ill post the code for the whole shop after this message

#
# shop.yml - Basic Blocks & Flowers Shop for Earth SMP

menu_title: '&a&lBasic Blocks & Flowers Shop'
size: 54 # Full 6-row chest

open_command: shop

items:
  # ====================================================================================
  #                                 DIRT BLOCKS (Slots 0-5)
  # ====================================================================================

  dirt:
    material: DIRT
    data: 0
    slot: 0
    display_name: '&fBuy Dirt'
    lore:
      - '&7Price: &a$10 &7per item'
      - '&7Click to buy 1!'
      - '&7Shift-Click to buy 64!'
      - ''
      - '&7Your balance: &a$%cmi_user_balance%'
    requirements:
      money_single_dirt: # Unique name for this requirement
        type: has money # CORRECTED TYPE
        amount: 10 # Price for 1 item
        deny_commands:
          - '[sound] entity_villager_no volume=1 pitch=1'
          - '[message] &cYou need &e$10 &cto buy 1x Dirt!'
    left_click_commands:
      - '[close]'
      - '[console] cmi money take %player_name% 10'
      - '[console] cmi give %player_name% DIRT 1'
      - '[message] &aYou bought 1x Dirt for $10!'
      - '[message] &7Your new balance: &a$%cmi_user_balance%'
    requirements_shift_left: # Unique name for shift-click requirement
      type: has money # CORRECTED TYPE
      amount: 640 # Price for 64 items
      deny_commands:
        - '[sound] entity_villager_no volume=1 pitch=1'
        - '[message] &cYou need &e$640 &cto buy 64x Dirt!'
    shift_left_click_commands:
      - '[close]'
      - '[console] cmi money take %player_name% 640'
      - '[console] cmi give %player_name% DIRT 64'
      - '[message] &aYou bought 64x Dirt for $640!'
      - '[message] &7Your new balance: &a$%cmi_user_balance%'

  grass_block:
    material: GRASS_BLOCK
    data: 0
    slot: 1
    display_name: '&fBuy Grass Block'
    lore:
      - '&7Price: &a$12 &7per item'
      - '&7Click to buy 1!'
      - '&7Shift-Click to buy 64!'
      - ''
      - '&7Your balance: &a$%cmi_user_balance%'
    requirements:
      money_single_grass:
        type: 'has money'
        amount: 12
        deny_commands:
          - '[sound] entity_villager_no volume=1 pitch=1'
          - '[message] &cYou need &e$12 &cto buy 1x Grass Block!'
    left_click_commands:
      - '[close]'
      - '[console] cmi money take %player_name% 12'
      - '[console] cmi give %player_name% GRASS_BLOCK 1'
      - '[message] &aYou bought 1x Grass Block for $12!'
      - '[message] &7Your new balance: &a$%cmi_user_balance%'
    requirements_shift_left:
      type: 'has money'
      amount: 768
      deny_commands:
        - '[sound] entity_villager_no volume=1 pitch=1'
        - '[message] &cYou need &e$768 &cto buy 64x Grass Blocks!'
    shift_left_click_commands:
      - '[close]'
      - '[console] cmi money take %player_name% 768'
      - '[console] cmi give %player_name% GRASS_BLOCK 64'
      - '[message] &aYou bought 64x Grass Blocks for $768!'
      - '[message] &7Your new balance: &a$%cmi_user_balance%'
#

this is just a segment of the whole thing tis too long for discord

tidal star
#

i think deluxemenus does not support "requirements_shift_left:"

#

im not sure but i think that theres only a single requirements section per item

#

you could try using conditions, not a second requirements block

#

example:

#
  material: DIRT
  slot: 0
  display_name: '&fBuy Dirt'
  lore:
    - '&7Price: &a$10 &7per item'
    - '&7Click to buy 1!'
    - '&7Shift-Click to buy 64!'
    - ''
    - '&7Your balance: &a$%cmi_user_balance%'
  conditions:
    can_afford_1:
      type: 'has money'
      amount: 10
    can_afford_64:
      type: 'has money'
      amount: 640
  left_click_commands:
    - '[close]'
    - '[requirement:can_afford_1] [console] cmi money take %player_name% 10'
    - '[requirement:can_afford_1] [console] cmi give %player_name% DIRT 1'
    - '[requirement:can_afford_1] [message] &aYou bought 1x Dirt for $10!'
    - '[requirement:can_afford_1] [message] &7Your new balance: &a$%cmi_user_balance%'
    - '[!requirement:can_afford_1] [sound] entity_villager_no volume=1 pitch=1'
    - '[!requirement:can_afford_1] [message] &cYou need &e$10 &cto buy 1x Dirt!'
  shift_left_click_commands:
    - '[close]'
    - '[requirement:can_afford_64] [console] cmi money take %player_name% 640'
    - '[requirement:can_afford_64] [console] cmi give %player_name% DIRT 64'
    - '[requirement:can_afford_64] [message] &aYou bought 64x Dirt for $640!'
    - '[requirement:can_afford_64] [message] &7Your new balance: &a$%cmi_user_balance%'
    - '[!requirement:can_afford_64] [sound] entity_villager_no volume=1 pitch=1'
    - '[!requirement:can_afford_64] [message] &cYou need &e$640 &cto buy 64x Dirt!'```
#

hope that helps @zinc stirrup