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:
1 parent
c06d71e213
commit
fecbddd938
1 file changed
+34
-1
@@ -547,4 +547,37 @@ AddEventHandler("playerDropped", function()
|
|||||||
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
||||||
end)
|
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
|
||||||
Reference in new issue
Block a user