#DeluxeMenu - Max usage per day

1 messages · Page 1 of 1 (latest)

fathom geode
#

I am trying to write a menu where a player can buy something from there but only do it 5 times a day.

What would be the best way to set this up?

sonic dock
#

easy peasy

sonic dock
#

okay so apparently I found a bug in deluxemenus, != comparatortype doesn't actually exist

sonic dock
fathom geode
#

Looking through the file if I wanted to do multiple items would I need to change this:

  stop_at_success: true
  requirements:
    nodate: # Needed to open the menu if the day is not set
      type: '=='
      input: '%deluxemenus_meta_DAILY-DATE_INTEGER_-1%'
      output: '-1'
      optional: true
      success_commmands:
      - '[meta] set DAILY-DATE INTEGER %server_time_D%'
      - '[refresh]<delay=1>'
    datechange:
      type: '!='
      input: '%deluxemenus_meta_DAILY-DATE_INTEGER_0%'
      output: '%server_time_D%'
      optional: true
      success_commands:
      - '[meta] set DAILY-DATE INTEGER %server_time_D%'
      - '[meta] remove DAILY-PURCHASED-ITEM1 INTEGER 0'
      - '[refresh]<delay=1>'
      - '[message] &aDaily Limits Refreshed!'
    datenotchange: # Needed to open the menu if the day doesn't change
      type: '=='
      input: '%deluxemenus_meta_DAILY-DATE_INTEGER_-1%'
      output: '%server_time_D%'
      optional: true```

To this:
``` minimum_requirements: 1
  stop_at_success: true
  requirements:
    nodate: # Needed to open the menu if the day is not set
      type: '=='
      input: '%deluxemenus_meta_DAILY-DATE_INTEGER_-1%'
      output: '-1'
      optional: true
      success_commmands:
      - '[meta] set DAILY-DATE INTEGER %server_time_D%'
      - '[refresh]<delay=1>'
    datechange:
      type: '!='
      input: '%deluxemenus_meta_DAILY-DATE_INTEGER_0%'
      output: '%server_time_D%'
      optional: true
      success_commands:
      - '[meta] set DAILY-DATE INTEGER %server_time_D%'
      - '[meta] remove DAILY-PURCHASED-ITEM1 INTEGER 0'
      - '[meta] remove DAILY-PURCHASED-ITEM2 INTEGER 0'
      - '[refresh]<delay=1>'
      - '[message] &aDaily Limits Refreshed!'
    datenotchange: # Needed to open the menu if the day doesn't change
      type: '=='
      input: '%deluxemenus_meta_DAILY-DATE_INTEGER_-1%'
      output: '%server_time_D%'
      optional: true```
#

Basically add another line to the Datechange Meta and to the click_requirement section for each item.

sonic dock
#

and the click_commands for each item

fathom geode
# sonic dock yep!

Hey man, Thanks for all the help. I tried to set it up and it sort of works. It does the 3 times but it doesn't seem to reset like it's suppose to. Any ideas what's wrong with my code?

open_command: moneyshop
size: 27

open_requirement:
  minimum_requirements: 1
  stop_at_success: true
  requirements:
    nodate: # Needed to open the menu if the day is not set
      type: '=='
      input: '%deluxemenus_meta_DAILY-DATE_INTEGER_-1%'
      output: '-1'
      optional: true
      success_commmands:
      - '[meta] set DAILY-DATE INTEGER %server_time_D%'
      - '[refresh]<delay=1>'
    datechange:
      type: '!='
      input: '%deluxemenus_meta_DAILY-DATE_INTEGER_0%'
      output: '%server_time_D%'
      optional: true
      success_commands:
      - '[meta] set DAILY-DATE INTEGER %server_time_D%'
      - '[meta] remove DAILY-PURCHASED-ITEM1 INTEGER 0'
      - '[refresh]<delay=1>'
      - '[message] &aDaily Limits Refreshed!'
    datenotchange: # Needed to open the menu if the day doesn't change
      type: '=='
      input: '%deluxemenus_meta_DAILY-DATE_INTEGER_-1%'
      output: '%server_time_D%'
      optional: true

items:
  'glass':
    material: WHITE_STAINED_GLASS_PANE
    slots: [0-26]
    hide_attributes: true
    display_name: ' '
    priority: 3

  'Virtual_Spawners':
    material: Spawner
    slot: 10
    display_name: 'Virtual Spawners'
    priority: 1
    lore:
    - ' '
    - 'Click here to access the Virtual Spawner Shop'
    - ' '
    - 'These spawners will not spawn entities but save all drops and experience virtually'
    - ' '
    click_commands:
    - '[close]'
    - '[player] vsmenu22234'

  'Sell_Wand':
    material: Stick
    slot: 13
    display_name: 'Sell Wand'
    priority: 1
    lore:
    - ' '
    - 'Click to buy a Sell Wand'
    - 'Left click to see sell quantity and price'
    - 'Right click to sell all items in the chest'
    - ' '
    - 'Cost: $400,000 for 100 uses!'
    click_requirement:
      requirements:
        Econ:
          type: has money
          amount: 400000
      deny_commands:
      - '[close]'
      - '[message]&#FF0040You Need More Money!'
    click_commands:
    - '[takemoney] 400000'
    - '[console] sellwandgive %player_name% tier_1'

  'Item1-Purchaseable':
    material: TRIPWIRE_HOOK
    slot: 16
    priority: 2
    display_name: 'Purchase A Legacy Cosmetic Key'
    lore:
    - ' '
    - 'Cost: $5,000,000'
    - 'Purchased: &6%deluxemenus_meta_DAILY-PURCHASED-ITEM1_INTEGER_0%'
    - ' '
    - 'Daily Limit: &c3'
    click_requirement:
      requirements:
        limitnotreached: # Backup requirement, duplicate of the view requirement for Item1-LimitReached. Put in place to avoid seeing the Purchaseable item when the limit HAS been reached.
          type: '!has meta'
          key: DAILY-PURCHASED-ITEM1
          meta_type: INTEGER
          value: 3
          deny_commands:
          - '[message] You''ve already purchased 3 keys today!'
          - '[refresh]'
        hasmoney: # Checks that the user has $10,000
          type: has money
          amount: 5000000
          deny_commands:
          - '[message]&#FF0040You Need More Money!'
    click_commands:
    - '[meta] add DAILY-PURCHASED-ITEM1 INTEGER 1'
    - '[console] ecrates key give %player_name% legacy 1'
    - '[takemoney] 5000000'
    - '[refresh]'
  'Item1-LimitReached':
    material: TRIPWIRE_HOOK
    slot: 16
    priority: 1
    display_name: "&cDaily Limit Reached 3/3"
    lore:
    - "&cYou've already purchased 3 keys today!"
    view_requirement:
      requirements:
        limitreached:
          type: has meta
          key: DAILY-PURCHASED-ITEM1
          meta_type: INTEGER
          value: 3
fathom geode
#

Or is there a way to reset when the server restarts?

sonic dock
#

it resets on the next day

#

i haven't checked your code yet tho

#

@fathom geode

#

is it not resetting on the next day?

fathom geode
#

No it's not

sonic dock
#

type /papi parse me %deluxemenus_meta_DAILY-PURCHASED-ITEM1_INTEGER_0% | %deluxemenus_meta_DAILY-DATE_INTEGER_-1% | %server_time_D%

#

what does it say

#

send a picture

fathom geode
#

3 | -1 | 324

sonic dock
#

seems the date was never set

#

hmm

#

lemme see

#

you don't have the permission to bypass open requirements by chance, do you?

#

deluxemenus.openrequirement.bypass.*

fathom geode
#

No, I tried it without OP commands

sonic dock
#

you should NOT have that perm

#

hmmmk

#

ahh

#

i see it

#

and it was my fault

#

I remember trying to find this mistake for AGES

#

glad it didn't take me as long this time

fathom geode
#

Yeah, that's the story of my life...

sonic dock
#

commmands

#

should be

#

commands

fathom geode
#

Alright, I changed it.

#

So I may have to wait until tomorrow to see if it works.

sonic dock
#

well

#

you can set your date to yesterday

#

/dm execute <player> [meta] set DAILY-DATE INTEGER 323

fathom geode
#

I did and it still says I used up all 3.

sonic dock
#

what if you open the menu again

#

just if the delay wasn't enough

#

it didn't send a message saying daily limits refreshed tho?

#

what version of deluxemenus are you on

fathom geode
#

I did. And I even went back another day and still doing the same thing. And no message.

sonic dock
#

the one i sent?

fathom geode
#

It is

fathom geode
#

3 | 322 | 324

sonic dock
#

hmm maybe the version i sent wasn't working, change != to !string equals

#

at the top for datechange

fathom geode
#

Still the same issue

sonic dock
#

can you send the current menu

#

?paste

silk heraldBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

fathom geode
sonic dock
fathom geode
#

A real head scratcher.

sonic dock
#

what if

#

you restart

#

and test it again

fathom geode
#

I have players on right now. So when the server does it's automatic restart in about 6 hours and after I get off work I can report back to you.

sonic dock
#

ah

#

here

#

add success commands to datenotchange

#

try that and see what message you're receiving

fathom geode
#

No messages

sonic dock
#

and you're not bypassing open requirements?

#

i mean, you're date got set earlier

fathom geode
#

correct

sonic dock
#

unless you changed perms

#

umm

#

how are you opening the menu

fathom geode
#

I havent' changed any perms and I doubled check to ensure that I don't have any set up

#

using the command /moneyshop

sonic dock
#

/moneyshop1?

fathom geode
#

Yeah

sonic dock
#

what if you /dm open <player> <menu> ?

#

idrk

#

seems like it's not refreshing the menu or something

#

no console errors or anything?

fathom geode
#

no console errors, and no messages

sonic dock
fathom geode
#

Try that?

sonic dock
#

yeah

fathom geode
#

No errors, no messages

sonic dock
#

/dm execute <player> [meta] remove DAILY-DATE INTEGER 0

#

then open the menu

fathom geode
#

Nope, nothing.

sonic dock
#

okay i'm gonna just check once more on your perms

#

you have NO PERMS?

#

for this user?

fathom geode
#

Correct

sonic dock
#

if you have the * perm

#

it means you have all perms

fathom geode
#

I'll set myself to default player without op perms

sonic dock
#

op or * would do it

fathom geode
#

Ok, now I'm getting debug 1

sonic dock
#

so it's working now i bet

#

set your date to previous date

#

and reopen

#

earlier, when your date got set you must have been default no-op

#

then changed perms or opped in between

#

an it stopped working because you were bypassing

fathom geode
#

debug 2, but unable to buy

sonic dock
#

reopen again

#

see if delay wasnt enough maybe

fathom geode
#

Ok, I did something wrong. Daily Limits refreshed appeared. but it still says I have purchased 3/3

sonic dock
#

after re-opening?

fathom geode
#

Reopened a second time and now it's working

sonic dock
#

yep the delay needs to be increased

#

go back to your original mmenu

#

without the debugs

#

or just remove them

fathom geode
#

I'll remove them

sonic dock
#

and increase the delay to 2 or 3 ticks

fathom geode
#

Alright

sonic dock
#

for datechange

#

and maybe for nodate too

#

idk if that really matters ngl

#

i feel that refresh is useless

#

can prob remove it

fathom geode
#

Alright, thank you very much for your help! You are awesome!

sonic dock
#

no problem

#

I would negate that bypass requirement from your perms just fyi

#

from the owner group or whatever

fathom geode
#

so set it to false?