Skip to content

Commit

Permalink
refactor(server/addCommand): add suggestion on command creation
Browse files Browse the repository at this point in the history
Delayed commands should trigger the suggestion.
  • Loading branch information
thelindat committed Feb 21, 2023
1 parent b47ae9d commit 47b8a72
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions imports/addCommand/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@

---@type OxCommandProperties[]
local registeredCommands = {}
local shouldSendCommands = false

SetTimeout(1000, function()
shouldSendCommands = true
TriggerClientEvent('chat:addSuggestions', -1, registeredCommands)
end)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 47b8a72

Please sign in to comment.