From 47b8a72527285ef1e4412b70637ccb4c882b5daa Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Wed, 22 Feb 2023 01:30:52 +1100 Subject: [PATCH] refactor(server/addCommand): add suggestion on command creation Delayed commands should trigger the suggestion. --- imports/addCommand/server.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/imports/addCommand/server.lua b/imports/addCommand/server.lua index a8d96c5..823acf5 100644 --- a/imports/addCommand/server.lua +++ b/imports/addCommand/server.lua @@ -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