mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-19 07:56:02 +01:00
refactor(server/addCommand): add suggestion on command creation
Delayed commands should trigger the suggestion.
This commit is contained in:
@@ -11,8 +11,10 @@
|
|||||||
|
|
||||||
---@type OxCommandProperties[]
|
---@type OxCommandProperties[]
|
||||||
local registeredCommands = {}
|
local registeredCommands = {}
|
||||||
|
local shouldSendCommands = false
|
||||||
|
|
||||||
SetTimeout(1000, function()
|
SetTimeout(1000, function()
|
||||||
|
shouldSendCommands = true
|
||||||
TriggerClientEvent('chat:addSuggestions', -1, registeredCommands)
|
TriggerClientEvent('chat:addSuggestions', -1, registeredCommands)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -132,6 +134,8 @@ function lib.addCommand(commandName, properties, cb, ...)
|
|||||||
if i ~= numCommands and numCommands ~= 1 then
|
if i ~= numCommands and numCommands ~= 1 then
|
||||||
properties = table.clone(properties)
|
properties = table.clone(properties)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if shouldSendCommands then TriggerClientEvent('chat:addSuggestions', -1, properties) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user