feat(commands): add pre-execution middleware event

This commit is contained in:
aysihuniks
2026-05-27 15:28:01 +03:00
parent 7104e8c81f
commit 9ff384b9fc
+4
View File
@@ -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 if permission == 'user' then restricted = false end -- allow all users to use command
RegisterCommand(name, function(source, args, rawCommand) -- Register command within fivem 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 if argsrequired and #args < #arguments then
return TriggerClientEvent('chat:addMessage', source, { return TriggerClientEvent('chat:addMessage', source, {
color = { 255, 0, 0 }, color = { 255, 0, 0 },