mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +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[]
|
||||
local registeredCommands = {}
|
||||
local shouldSendCommands = false
|
||||
|
||||
SetTimeout(1000, function()
|
||||
shouldSendCommands = true
|
||||
TriggerClientEvent('chat:addSuggestions', -1, registeredCommands)
|
||||
end)
|
||||
|
||||
@@ -132,6 +134,8 @@ function lib.addCommand(commandName, properties, cb, ...)
|
||||
if i ~= numCommands and numCommands ~= 1 then
|
||||
properties = table.clone(properties)
|
||||
end
|
||||
|
||||
if shouldSendCommands then TriggerClientEvent('chat:addSuggestions', -1, properties) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user