I'm trying to allow admins with permission to do /report block user, and block a user from using a command in my plugin. I decided to do it by giving a user a permission if I don't want them to use the command. I know you can grant permissions to users via in-game command, but I wan't it to be any user who has the permission discordreport.use. Something like this:
Code (Text):
[Command("block")]
if(player.HasPermission(permBlock)
{
//This is the line I'm unsure of how to do. I cannot find any documentation on this.
targetUser.AddPermission(permIsBlocked);
}
obviously that's just psuedo but yea.
I believe forcing the player to run the '/grant user permission' command would work. Does anyone know how to do that?
Thanks
Forcing a player to run a command?
Discussion in 'Rust Development' started by Bobakanoosh, Feb 14, 2017.
-
Wulf Community Admin
Why do you need them to run the command? Just use permission.GrantPermission if you want to give them a permission.
-
Is that a console command?
I have to get to work I'll explain after -
Wulf Community Admin
-
Code:player.SendConsoleCommand("Command_Here"); //Client Console
Code:namespace Oxide.Plugins { [Info("Test Plugin", "Kappasaurus", "0.1.")] class TestPlugin : RustPlugin { void Loaded() => permission.RegisterPermission("testplugin.blockuse", this); [ChatCommand("test")] void cmdTest(BasePlayer player, string cmd, string[] args) { if (!permission.UserHasPermission(player.userID.ToString(), "testplugin.blockuse")) { //Command Code Here } else { //Command Block Message //SendReply(player, "..."); } } } }
Last edited by a moderator: Feb 15, 2017 -
What you gave might work, but what wolf gave is much easier and more realistic to what I need.
-