How to kick players using the Adonis Admin's API?

Hello guys.
I’d like to issue the Adonis “:kick” command with the server in order to make a mini anti-exploit script.
I’ve been trying to issue that command using _G.Adonis but it’s not working: it keeps to output errors or to just do nothing.

Here’s my current Allowed_API_Calls configuration:
image

In the Admin module I found the “RunCommand” function, which I thought it would have solved all my problems, so I tried to do the following:

local Admin = _G.Adonis.Access(SecurityKey, "Admin")
Admin.RunCommand(":kick", Player, Message)

But unfortunately, the result is an “Access Denied” error, even though the Admin module is enabled in API calls as you could see from the previous image.
image

I even found the “Kick” function in the “Remote” and in the “Commands” modules but there was no way to call the functions.

I perfectly know that kicking a player just by using a script and a line of code would be much easier, but I’d like to use Adonis in order to better administrate my game.

Thanks for reading and thanks in advance for your help! :sweat_smile:

in the setting modules, there is a area where you can enable the api.

Everything has already been enabled, but I still don’t get how to issue that command.

image

make sure that the settings.G_API is true and the api you want in the table below.

both G_API and G_Access are set to true. Even because I’m using the Adonis module for other things as well.

you see the dictionary on the bottom? make all those values true not false.

Not all those values need to be set to true, just the ones needed, even because I think that setting everything to true might cause security issues.

i didnt know you were teaching me. those apis are for server scripts only but i do see your point. I think you have the run command wrong. try this

Admin.RunCommand(":kick" .. plrToKick.Name, PlayerWhoRan)

The Access Denied error is still there, as if I couldn’t run the command even though I have the perms to do so.

Does anyone have a fix for this, I encountered the same problem

you can only access _G.Adonis to read it as settings.G_Access_Perms is set to “Read”

1 Like

Make the
Core = true;

Sorry for replying after 3 years, I don’t understand the settings either,
but I just found this error and I’ve checked the module, that if you have to make the Core true, to not see that error.

now Access Denied: RunCommand solved, but I still can’t kick :joy:

when Admin.RunCommand(":kick", Player, Message) runs
the output shows this:

MainModule.Server.Core.Core:656 is local key = tostring(p.UserId)
I tried print(p), and the p is somehow “false”.