Ticket Limits
Last updated
Last updated
This subpage consists of followup steps to Apm Ticket System. Make sure to complete that guide first.
For this, you will need to create a new custom variable to track how many tickets a user has.
When creating a new custom variable, since this will be to track a user's number of tickets, you will need to make this a user variable. This means, the value will be different for each user.
Also, in this example, we will set the Sub-Type to 'Number', as we'll use this to count how many tickets the user has open.
To add to a user's ticket count each time they open a ticket, head to your 'Create a Channel' block, and place a 'Calculate Variable' block afterwards.
Then feel free to set the 'Calculate Variable' block to the following settings:
Once a ticket has been closed, you must remove 1
from the user's ticket counter. Otherwise, their counter will be inaccurate. In order to do this, place a 'Calculate Variable' block after your 'Close Ticket' button.
Since we will need to edit the variable of the ticket opener, and not the interacting user, we must have a unique variable to store the ticket opener's ID.
Set your 'Calculate Variable' block to the following settings:
Now, your ticket counter is complete! Each time a user opens a ticket, their counter will +1
. If their ticket is closed, their counter will -1
.
To check if a user has x tickets, place a 'Comparison Condition' block before your 'Create Channel' block. This condition will check how many tickets a user has open.
In this guide, I'll limit a user's open tickets to 3. If they are trying to open another ticket, despite having 3 open, they will be denied.
To start, set your comparison block's general Comparison Value to {unique_user_tickets}
.
After, create a condition. In this condition, enter your ticket limit number - for example, I am limiting the number of tickets users can have at 3.
In this condition, you can add a message that notifies the user that they are at the ticket limit.
If you'd like to add any 'bypass' roles, or users, you will need to use another condition. These users will be able to avoid any ticket limit, and open as many tickets as they'd like.
See the following image for an example.
To have this work properly, you must have the server ad the apm sends go through the bot.
There are multiple ways of setting a limit of ads per ticket. For example, you can disable the 'Click to Continue' button, that allows a user to send their ad through the modal, or by using a unique variable to count each ad sent.
When using the ad counter method, you can add additional checks such as to check for a bypass role. In this case, you can remove the ad limit for those with a bypass role.
When disabling a button, making checks such as for a bypass role is a bit more difficult, as you'll need multiple button blocks per condition you make. Therefore, if you wish to have a condition such as to check for a bypass role, you should use an ad counter.
If you have not previously set up a unique variable called {unique_ticket_opener}
, visit . Follow those steps, then come back here to continue.
If you did not follow , please revert back and introduce those steps.