From bac9eb576d4dd61f37dd0e4474ac33fa618695d9 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Wed, 14 Sep 2022 00:54:44 +1000 Subject: [PATCH] feat(client/resource): RegisterCommand wrapper All these tweaks so we can check ACL for client commands. --- resource/client.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 resource/client.lua diff --git a/resource/client.lua b/resource/client.lua new file mode 100644 index 0000000..f94961f --- /dev/null +++ b/resource/client.lua @@ -0,0 +1,12 @@ +local _registerCommand = RegisterCommand + +---@param commandName string +---@param callback fun(source, args, raw) +---@param restricted boolean? +function RegisterCommand(commandName, callback, restricted) + _registerCommand(commandName, function(source, args, raw) + if not restricted or lib.callback.await('ox_lib:checkPlayerAce', 100, ('command.%s'):format(commandName)) then + callback(source, args, raw) + end + end) +end