What if you just want to append an anticheat system and not a command module to it? Where it auto-bans people, but ofc with CMDR, you can unban them with the system? Is it possible to connect to the datastore and augment it without having everything be based on a manual command?
Indeed! You can have an unban command, which has a playerId argument and removes the ban entry from the data store. You can have your anti-cheat outside of the command and ban people directly without a command.
Is there a tools argument that automatically finds tools in the games and formats them into the auto-completion code?
Whats the security of this? Im thinking about using it if its safer then any other admin plus it makes it so you can make your own commands for your game I wanna know how safe this is before using it but i probably will use it anyways
anyone know how i could make my own command’s args autocomplete? (using Registry i guess)
@TwoBrakeRBX You can create a tool type. The easiest way to do it is with an enum type, which will handle validating, autocompleting, and parsing the argument. If you pass the folder of tool instances into Util.MakeEnumType()
, you will have the tool instance in your command implementation.
@spydercam500 You will have to create your own hooks, specifically a BeforeRun hook to prevent commands from being executed.
@LordEmotionless You can create your own types for your command arguments.
Yep I saw it months ago, but thanks for the reply man
How do you add more ranks? I want a moderator and an admin rank but have no clue
You will need to create hooks, specifically a BeforeRun hook, to create your permissions as Cmdr does not come with a permission system by default.
Hooks Guide: Hooks | Cmdr
Thanks, I’ve already seen this but I’m not sure how to allow certain commands for only admins and not moderators.
You would determine that based on the command’s Group property. If you can send your BeforeRun hook, I could provide you with better help.
admins = {
[40527673] = true,
[482217345] = true
}
return function (registry)
registry:RegisterHook("BeforeRun", function(context)
if context.Group == "DefaultAdmin" and not admins[context.Executor.UserId] then
return "You don't have permission to run this command"
end
if context.Group == "Moderator" and not (context.Executor:GetRankInGroup(3904755) == 4) then
return "You don't have permission to run this command"
end
registry:RegisterHook("AfterRun", function(context)
print(context.Response)
return "Command has been run."
end)
end)
end
This is what i’ve tried to do, have a list of admins and moderators by group rank
The problem is with the command group property, how do i allow for multiple groups to use that one command?
Like if i wanted both mod and admin to be able to use /fly then what would i change in Group = “DefaultAdmin”;?
If you want administrators to use commands under the Moderator group, add and not admins[context.Executor.UserId]
to the if statement checking if the command’s group is Moderator.
Side note, you should remove the AfterRun hook if you are not using it.
This is one of the commands, where would I add that in?
If you wish to allow moderators to use that command, change the Group property to Moderator.
I appreciate your help and I’m sorry for asking so much but what if I want the admins to be able to use that command too?
You should add and not admins[context.Executor.UserId]
to the if statement checking if the executor can execute a command in the Moderator group.
The last release of this was in 2020, is there still active development on this?
Yes, the project is still maintained. Cmdr is mostly stable, there are some new changes if you build from source. I’ll cut a new release here in a few weeks, probably.
sry, what’s the keybind to open the ui ? i tried f2