Limited Use Menus

Limited Use Menus & Items

Limiting the usage count of a menu or menu item

Note: This feature probably makes most sense in conjunction with permission elevation (via the command parser), which allows users to run commands they don't normally have permission to run. There's little point in adding usage limits to commands that users can run directly anyway!

Say you have a menu with an item that gives a reward to a player when clicked, but you only want it to happen once. You can do this:

/sms uses mymenu reward 1

Now the reward menu item on mymenu can only be clicked once per player.

Usage limits can also be set on entire menus:

/sms uses mymenu 1

Now the entire menu can only be clicked once per player. If there are usage limits on both the menu and the item, then both limits must not be exhausted for a player to be able to execute the item.

If the menu item has spaces in it, surround it with quotation marks, e.g.:

/sms uses mymenu "Get Reward" 1
# or use a numeric index, e.g. for the 5th item in the menu:
/sms uses mymenu 5 1

Note the limit stays with the item, so it will still apply even if the menu is rearranged (by /sms sort, /sms add or /sms edit).

If you want to set the usage limit for an item for all players (so it can be clicked once only, ever):

/sms uses mymenu reward 1 -global

Of course, you can supply any usage count you want - the limit doesn't have to be 1.

You can use these same commands to reset the usage limit if you need to, and if you want to remove the usage limit altogether, you can do:

/sms uses mymenu reward clear

Examples

This menu lets players pick one reward:

/sms menu create rewards Pick One
/sms add rewards Diamond "/@give diamond"
/sms add rewards "2 Gold" "/@give goldblock 2"
/sms add rewards "2 Iron" "/@give ironblock 2"
/sms uses rewards 1

The following menu lets players pick any two of three possible rewards (each item can be selected once, but the entire menu can only be selected twice):

/sms menu create rewards Pick Any Two
/sms add rewards Diamond "/@give diamond"
/sms add rewards "2 Gold" "/@give goldblock 2"
/sms add rewards "2 Iron" "/@give ironblock 2"
/sms uses rewards 2
/sms uses rewards 1 1
/sms uses rewards 2 1
/sms uses rewards 3 1

Comments

Posts Quoted:
Reply
Clear All Quotes