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.
Adding a permission to a plugin?
Discussion in 'Rust Development' started by NemesisRust, Jun 18, 2018.
-
register the permission in init()
Code:void Init() { permission.RegisterPermission("pluginname.whatever", this); }
Code:if (permission.UserHasPermission(player.userID.ToString(), "pluginname.whatever")){ //your code here }
Last edited by a moderator: Jun 18, 2018 -
Code:private bool HasPermission(BasePlayer player, string perm = "plugin.permission") => permission.UserHasPermission(player.UserIDString, permission) || player.IsAdmin;
Code:if (!HasPermission(player)) { // Send message? return; }// Perform actions