mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 17:58:54 +00:00
Implemented adding chat suggestions, closes #512
This commit is contained in:
@@ -328,6 +328,15 @@ AddEventHandler('esx:createMissingPickups', function(missingPickups)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:registerSuggestions')
|
||||
AddEventHandler('esx:registerSuggestions', function(registeredCommands)
|
||||
for name,command in pairs(registeredCommands) do
|
||||
if command.suggestion then
|
||||
TriggerEvent('chat:addSuggestion', ('/%s'):format(name), command.suggestion.help, command.suggestion.arguments)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:removePickup')
|
||||
AddEventHandler('esx:removePickup', function(id)
|
||||
ESX.Game.DeleteObject(pickups[id].obj)
|
||||
|
||||
@@ -36,6 +36,8 @@ ESX.RegisterCommand = function(name, group, cb, allowConsole, suggestion)
|
||||
if suggestion then
|
||||
if not suggestion.arguments then suggestion.arguments = {} end
|
||||
if not suggestion.help then suggestion.help = '' end
|
||||
|
||||
TriggerClientEvent('chat:addSuggestion', -1, ('/%s'):format(name), suggestion.help, suggestion.arguments)
|
||||
end
|
||||
|
||||
ESX.RegisteredCommands[name] = {group = group, cb = cb, allowConsole = allowConsole, suggestion = suggestion}
|
||||
|
||||
Reference in New Issue
Block a user