Skip to content

feat(commands): add pre-execution middleware event - #1222

Merged
GhzGarage merged 3 commits into
qbcore-fivem:mainfrom
aysihuniks:main
Jun 17, 2026
Merged

feat(commands): add pre-execution middleware event#1222
GhzGarage merged 3 commits into
qbcore-fivem:mainfrom
aysihuniks:main

Conversation

@aysihuniks

Copy link
Copy Markdown
Contributor

Description

Added the QBCore:Server:PreCommandExecution event inside QBCore.Commands.Add, triggering just before the command callback.

This allows developers to easily create middleware (e.g., for custom logging or anti-cheat checks) and stop command execution using CancelEvent() without having to modify core files.

Checklist

  • I have personally loaded this code into an updated qbcore project and checked all of its functionality.
  • My code fits the style guidelines.
  • My PR fits the contribution guidelines.

Copilot AI review requested due to automatic review settings May 27, 2026 12:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a server-side “pre command execution” hook for QBCore commands so other resources can intercept (and optionally cancel) command handling.

Changes:

  • Emit QBCore:Server:PreCommandExecution when a command is invoked.
  • Allow cancellation of command execution via CancelEvent() / WasEventCanceled().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/commands.lua Outdated
Comment thread server/commands.lua Outdated
@GhzGarage
GhzGarage merged commit 37d3b84 into qbcore-fivem:main Jun 17, 2026
2 checks passed
github-actions Bot added a commit to dexter9006/qb-core that referenced this pull request Jul 6, 2026
…m#1222 from aysihuniks/main

feat(commands): add pre-execution middleware event
github-actions Bot added a commit to M4RFY/qb-core that referenced this pull request Jul 10, 2026
…m#1222 from aysihuniks/main

feat(commands): add pre-execution middleware event
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants