Update server.lua

Added missing command registration support for the Qbox framework module.

The ESX and QBCore framework modules already expose `Framework.Commands.Add`, but the Qbox module did not define `Framework.Commands`, causing resources that rely on the unified Community Bridge command API to fail on Qbox
This commit is contained in:
PeppeSg authored and GitHub committed 2026-05-05 02:01:11 +02:00
1 parent c06d71e213
commit fecbddd938
1 file changed
+34 -1
+34 -1
View File
@@ -547,4 +547,37 @@ AddEventHandler("playerDropped", function()
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
end)
return Framework
AddEventHandler("playerDropped", function()
local src = source
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
end)
Framework.Commands = Framework.Commands or {}
---@description Adds a command to the Qbox framework
---@param name string
---@param help string
---@param arguments table
---@param argsrequired boolean
---@param callback function
---@param permission string
---@param ... any
Framework.Commands.Add = function(name, help, arguments, argsrequired, callback, permission, ...)
lib.addCommand(name, {
help = help or "",
params = arguments or {},
restricted = false
}, function(source, args, raw)
if permission and permission ~= "user" then
if not Framework.GetIsFrameworkAdmin(source) then
return
end
end
callback(source, args or {}, raw)
end)
end
return Framework
return Framework