Tutorial/Advanced Usage
Advanced Usage
Effective as of CommandSigns v1.8.0
Allowing use of OP commands
If the command '/i diamond 1' is on a CommandSign, you may find that only operators and those with enough permission will be able to use the command. But if you want anyone to be able to use the command, you need to do one of the three following things.
There are 'meta-characters' that can go just after the forward slash '/' in your command. These meta-characters are '*', '^' and '#'. They're used like this.
1. /*acommand 2. /^anothercommand 3. /#yetanothercommand
This is what they do:
- '*' means that the user will have access to the '*' permission node (everything) whilst running the sign.
- '^' means that the user will be granted OP whilst running the sign.
- '#' means that the command will be run from the console, without any player data being sent along with it.
So as for the '/i' command, it would make sense to run it as an OP because by default, OPs can use it. '/*' will also work, whereas '/#' will not as the command does need player information to work.
1. /^i diamond 1
Sorted.
Variables
Variables are bits of text in your CommandSign that can change according to various conditions. An example is the name of the player that clicked the sign, or their location.
Variables are accessed like this:
/commandsigns line1 /dosomethingwith <variablename>
The variable can be one of the following:
- <x> - Player's x coordinate
- <y> - Player's y coordinate
- <z> - Player's z coordinate
- <world> - Player's current world
- <name> - Player's user name
- <display> - Player's display name
- <money> - Player's current money balance
- <formatted> - Player's current money balance formatted. (Ex. "10.00 dollars")
Here's a fun one for you:
/commandsigns line1 /nuke <name>
Restrictions and Permissions
It's all well and good if you just want to make a list of commands to run, but what if you only want some users to be able to use it, or have a delay between using it. This is a job for restrictions.
A restriction goes like this:
- {condition}
- /commands
- -
The {condition} part consists of a symbol, followed by text describing the condition. Here are the valid conditions you can use:
- `@groupname` - Restrict access to only that group.
- `&permission` - Require the specified permission node. This means you can make up your own permission nodes too!
- `$amount` - Make the CommandSign cost a certain amount to the player.
- `timeinseconds` - Restrict usage to once every ? seconds.
- `>>' - Restrict sign usage to right-clicking only.
- `%percent` - Restrict sign to work only a certain percentage of the time.
So now we can make a real example. Lets say only people in the group 'vip' can use the command `/get bacon`:
1. @vip 2. /get bacon 3. -
Nesting restrictions
But it doesn't stop there! You can also 'nest' restrictions inside each other. This means that the same '/get bacon' command above can only be used by VIPs and only once every 10 seconds for example.
1. @vip 2. ~10 3. /get bacon 4. --
Notice how I put two '-'s at the end of the restrictions? You don't have to do that, you could have just had the second one on line 4, but to save space, you can put several on the same line. They must be before any commands or conditions though. More on that in the Syntax section below.
Update
As of v1.8.3, you can now define multiple permission nodes and groups in the same condition; just separate them with a comma!
1. @vip,mod,admin 2. ~10 3. /get bacon 4. --
This also works for:
1. &permission.node,another.permission 2. ~10 3. /get bacon 4. --
Read commas as 'OR'.
Negating / using 'not' in conditions
What if you want everyone not in the VIP group to run a different command instead? Lets say they should run `/get coal`. That's easy too. There is another meta-character known to you and me as '!'. This is the 'not' operator. It can be used like this:
1. !@vip 2. /get coal 3. - 4. @vip 5. ~10 6. /get bacon 7. --
On its own line, the '!' character acts as an else, inverting the restrictions on the sign. The above code could also be accomplished like this, using else:
1. @vip 2. ~10 3. /get bacon 4. - 5. ! 6. /get coal 7. -
Optional conditions
Now we're starting to get something that looks cool. One final thing: if we run this, we'll get the error 'You are not in the required group to run this command' no matter who you are. You can fix this by using one last meta-character: '?'. This makes the condition an optional check. It shouldn't report to the user that they didn't match the condition.
1. ?!@vip 2. /get coal 3. - 4. ?@vip 5. ~10 6. /get bacon 7. --
Alternatively, with else:
1. ?@vip 2. ?~10 3. /get bacon 4. - 5. ! 6. /get coal 7. -
There we go. Now as a result of this, non-VIPs will be given coal, VIPs will be given bacon (but only once every 10 seconds), and nobody will get any errors along the way.
Additional commands
There is one other command that you can use alongside your normal ones. That is the delay command. It's simple to use, just type this:
1. \Waiting 5 seconds... 2. %5 3. \Finished!
That makes the current CommandSigns pause for 5 seconds. Don't worry, this doesn't lag your server at all!
Silent Commands
The '?' Operator also works on console commands, (1.7+) and on player commands. (1.8+) To run a player command silently, simply prefix the line with '?', for example:
1. ?/i diamondsword 1
Syntax
There are a few rules and shorthand ways of writing CommandSigns. You should already know from earlier that the '/commandsigns' command can also be accessed from '/cmdsigns' and '/cs', and you can use '5' instead of 'line5' (v1.8+), but there are also some tricks to make conditions and restrictions easier to remember.
The meta-characters '-', '?' and '!' can appear in any order provided they are before a condition or a command. Yes, that means you can put a '-' on the same line as another group condition and you can use multiple '-'s on the same line. That means the previous code could look like this:
1. !?@vip 2. /get coal 3. ?-@vip 4. ~10 5. /get bacon 6. --
And that will still be completely valid.
Remember that the '-' character will end the last condition that was opened.
Using CommandSigns with CommandHelper
If you need more advanced processing in signs, CommandHelper is a good plugin to work with. CommandSign commands will use CommandHelper aliases over registered commands if they're available, (1.8+) so it's a very good way to get extra programming functionality. To restrict an alias to just a sign, you can add an op requirement to the alias and run it as '/^alias'.
Batch Processing
By typing /cmds batch, (1.8+) you can enter batch processing mode. In this mode, read, enable, and remove operations can be done multiple times in a row with the same state. This is good if you need to remove a lot of signs, or make several signs with the same text. Here's an example of how one might use it:
- Put some text in the clipboard with /cmds line1 \test
- Enter batch enable mode with /cmds batch
- Click multiple signs. They'll all be given the same contents.
Hey is there a way you could add a direction variable for the TP cammands? so i can change the way they face when they use the sign...by default it faces them south.. :/
I want to install: User clicks sign for day, pays 10 and, it's day!, but how???
so if i wanted to have a sign that give a player a pex permission would i use <name> in the command to return the name of the player using the sign so the permission plugin would know who to give it to?
@SpiderX131
/cmds line1 $10 /cmds line2 /^time set day
here you are:)
@epixmark & @SpiderX131
EDIT
The Third One :D is Additional :D
How do you restrict the sign to only work a certain percent of the time?
Helooo. This is a great plugin !!
I want to make other users leaders of the group and they can move user to his group... Is it posible so the leader can click a sign and type the name of the player adh he will join the group - this is the command: /pex user <here> group set fbi... When the leader click the sign and type the name of a player, the player name will be inserted there where is <here>... O and sorry for my english xD... Thanks
Hi I love this plugin but I do have a question about the random something.
`%percent` - Restrict sign to work only a certain percentage of the time.
Well this mean I should type /cmds line1 %50 << then this should make the sign works 50% of the time But I do find out that %50 also means to delay 50 seconds and the sign actually delayed 50 seconds and the random chance didnt work at all Anyone can show me how to get the random chance thing work ??
So, how would I do something like make people pay to rank up? I already did this but I found with the command I was using there is a problem: It lets the player rank up and takes the specified amount of money, but it allows them to rank up even if they don't have ENOUGH money. Let's say something costed $5000 and they only had $2000, it brings their balance to $0 but still lets them rank up. Any way to fix this?
@poobis
Probably because you have Essentials which is allowing users to have minus amount in config?
@fungreenfox
No, I changed the config in essentials it still doesn't work. I could do what I want to do, but I can't get the cost to work. What I use now is /^eco take <name> etc, but I want to use the $amount condition do you know how to do that? Can I get an example of what to do with it?
Is there a way to ADD permissions to a player using groupmanager with this?
I wanted to let people chose for a group and that once you chose one group you can't get back. This is what my sign looks like:
When I write the group with a capital letter, it just ignores and does given commands, even if your not in that group. But when I write the group without a capital it says that I'm not allowed to use the sign even if I'm the right group.
I already checked the permissions and every group does have the right permissions to use it I thought. thedefaultgroup has the permissions: commandsigns.use.* and commandsigns.group.* every other group has the permission: -commandsigns.group.* Please tell how to get this working.
@poobis
You wil need to skip the eco take line and use
cmds #line no. $100
would take 100 dollars from his account if he has 100 - else no executing of the next.
@bassie11
I am working on exact same problem and i think i have found out why.
I can not get it to choose between the groups, cmds is just executing whatever group is mentioned.
If you cant use the sign, you are either not in thedefaultgroup, or does not have the warp permission. Warp permissions can be set to work on a world or permission node basis. Ex. if you have world permissions and want him to warp to another world, he will need the essentials.worlds.world permission node too.
You are using manuadd as a console command, and console will perform this regardless of permissions.
What we are looking for, is a specific permission node allowing the user to move himself to a specific group. But ess3.net is down atm. and i don't know what it would be.
So solution is executing manuadd as usercommand, and the user has the manuadd permission to do so on his own.
i imagine it could look like this
groupmanager.manuadd.groupname
Giving the usergroup the node groupmanager.manuadd will posibly work but is risky, if the user knows the command, he can then add himself to any group.
I have also found that skipping the slash before @defaultgroup has influense on the executing:
text:
- /^@quiz
- /^manuadd <name> default
VS:
text:
- @quiz
- /^manuadd <name> default
If you edit this from the script followed by /cmds reload, make sure you do not have any tabs.
There is also a statement @node in cmds, which will look for a nodepermission at the user.
If you give groupmanager.manuadd.architect to the user, and he clicks it, cmds will check and see if he has the node, but not if groupmanager can act with the node. So basically, you can just add the node to his group and he will have the permission the execute the following line.
Let me know what you find out please.
NB: you might want to move the warp below the manuadd. They might need the group before the warp?
@fungreenfox
I solved my problem by letting only people from the default group using signs with /* /^ or /#. All other groups cannot use those signs and noone, who isnt supposed to have the node groupmanager.manuadd, has this permission node, so noone can abuse this command. My sign looks like this now:
Everyone has all the warp permissions and you're not going to another world, so that cant be a problem.
Maybe you should let cmds check first if a user has the permission node commadsigns.group.* before cmds executes the commands.
Thanks for replying so fast and for your help. I hope you get it fixed soon!
@bassie11
i got it to work setting correct permissions, now only ppl in the group mentioned will affect the sign. cool
With this plugin, is it possible to have 2 commands executed from one sign?
For example. I want to make signs where players can purchase MCMMO skill points. So when they hit the sign they get the skill points and it deducts the amount from their balance.
Hi there Can i make the person to use the sign just once? And is it fixed that problem with essentials eco? to buy a house for 5000$ when you have just 1$ with 0$ for minimum in essentials config file?
@Rhidzla
use the following lines in game
/commandsigns 1 $1000
using the $ sign on line 1 makes the sign a "purchase" sign. When this sign is clicked it will try to deduct $1000 from the players wallet.
/commandsigns 2 /^addxp Liacor unarmed 100
The 2 in this line makes it so this is ran second. The /^ Makes the command run as if the user was OP so even non-opped players can add XP. Then it is the player, the skill, then the amount.
Liacor