1. A plugin I'm working with does not have a permission requirement to be used, which would allow all players to use the plugin I'm adding. I'm wanting to add a permission to use the plugin, however I have no idea how to do this.
     
  2. register the permission in init()
    Code:
    void Init()
            {
                permission.RegisterPermission("pluginname.whatever", this);
            }
    then ask for permission wherever you want:
    Code:
    if (permission.UserHasPermission(player.userID.ToString(), "pluginname.whatever")){
    //your code here
    }
     
    Last edited by a moderator: Jun 18, 2018
  3. That's a lot of code, instead I'd do something like this.
    Code:
    private bool HasPermission(BasePlayer player, string perm = "plugin.permission") => permission.UserHasPermission(player.UserIDString, permission) || player.IsAdmin;
    Then you can do this.
    Code:
    if (!HasPermission(player))
    {
        // Send message?
       return;
    }// Perform actions