From 9ff384b9fcef79d1914eb4839721897c2c60c261 Mon Sep 17 00:00:00 2001 From: aysihuniks Date: Wed, 27 May 2026 15:28:01 +0300 Subject: [PATCH] feat(commands): add pre-execution middleware event --- server/commands.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/commands.lua b/server/commands.lua index 7048ca1..bd1c728 100644 --- a/server/commands.lua +++ b/server/commands.lua @@ -21,6 +21,10 @@ function QBCore.Commands.Add(name, help, arguments, argsrequired, callback, perm if permission == 'user' then restricted = false end -- allow all users to use command RegisterCommand(name, function(source, args, rawCommand) -- Register command within fivem + + TriggerEvent('QBCore:Server:PreCommandExecution', source, name, args, rawCommand) + if WasEventCanceled() then return end + if argsrequired and #args < #arguments then return TriggerClientEvent('chat:addMessage', source, { color = { 255, 0, 0 },