Create your own Command Permissions

Creating the command on the file
1. Open the file "permissions.xml".

2. Before the tag "" add your command with the format:  NOTE: Please remember to add to the groups the color code of the actual group color, (for example, if the group Admin color is red, you should add the group as ~r~Admin. If you don't understand, just add the command, open the launcher, go to tab "Commands" and it should appear there).

3.That's all!

Creating the command on the script
1. On your script main class, and insert on the start: using System.Xml; 2. Right after you declare the class, create a Array with the default groups for the command (here you don't need the color codes, just the group name). Example: namespace Testing {   public class Test : APIScript {       /// DECLARE A ARRAY TO SAVE YOUR GROUPS FOR THE COMMAND string[] yourcommandnameGroups = { "Guest", "User", "Mod" }; 3. On the Start void, load the "permissions.xml" file. Then, create a XmlNodeList var and get the element by tag (the command you created on "permissions.xml" before).

4. Then save on the Array you created before (yourcommandnameGroups) the groups. Example: public override void Start {           /// RE-LOAD THE PERMISSIONS DOCUMENT PermDoc.Load(PermissionsPath); /// CREATE A NODE LIST TO SAVE THE NODES, IN THIS CASE, ONLY THE NODE YOU CREATE BEFORE ON PERMISSIONS.XML XmlNodeList yourcommandnameNodes = PermDoc.GetElementsByTagName("yourcommandname"); /// GET THE ATTRIBUTES (GROUPS) OF A NODE (TESTCMD), SPLIT BY COMMA AND SAVE IT ON THE ARRAY WE CREATE BEFORE yourcommandnameGroups = (yourcommandnameNodes[0].Attributes["group"].Value).Split(','); } 5. On the OnChatCommand void, split the command by spaces and create an IF condition where if the command is the command you want, check if the player has permission and execute the command. Example: public override void OnChatCommand(User player, string command) {           string[] cmd = command.Split(' '); if (cmd[0] == "/testcmd") {               /// IF THE PLAYER HAS PERMISSION if (PlayerHasPermission(player, yourcommandnameGroups, userDictionary)) {                   SendMessageToPlayer(player, "[~g~TEST~w~]", "It works! Your group: " + GetPlayerGroup(player, userDictionary)); }               else {                   SendMessageToPlayer(player, "[~b~YOUR PLUGIN~w~]", "You don't have permission!"); }           }        } 6. That's all! Easy, isn't?