mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-28 17:01:16 +00:00
feat(commands): add pre-execution middleware event
This commit is contained in:
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user