Any way to run a player command from a plugin?
I'm planning on making something that allows the console and command blocks to run commands as if they were a player. You would put like /run [SomePlayerCommand] inside of a command block and when powering it, it would execute it as if it was a player in the overworld with rank Admin. Has anyone done something like that before or knows what functions to call to make this work?

And for all those shouting "Just use cPluginManager.ExecuteCommand":
It doesn't seem to work correctly for my usecase. At least not in the way I tried to use it before.
Here is my current code that doesn't work:
function run(Split)
    if (#Split < 2) then
    -- There was less than one argument (excluding the "/" bit)
    -- Send the proper usage to the player and exit
    cRoot.BroadcastChatInfo("/say You need to provide a command.")
    return true
    cPluginManager.ExecuteCommand(cPluginManager, tostring(Split))
    return true

I'm so terrible at lua that even the help message won't work:
error in function 'BroadcastChatInfo'.
     argument #1 is 'string'; 'cRoot' expected.
Thanks given by:

Messages In This Thread
Any way to run a player command from a plugin? - by mueller_minki - 02-20-2021, 06:38 AM

Users browsing this thread: 1 Guest(s)