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