cfx-server-data
cfx-server-data copied to clipboard
chat:removeSuggestion does not allow re-adding the same command
As seen here: https://github.com/citizenfx/cfx-server-data/blob/9914752788f8f92fb5eb8b11db871e9e43891525/resources/%5Bsystem%5D/chat/html/App.js#L82-L86 and here: https://github.com/citizenfx/cfx-server-data/blob/9914752788f8f92fb5eb8b11db871e9e43891525/resources/%5Bsystem%5D/chat/html/App.js#L45-L49 this method actually blacklists a chat command suggestion, it doesn't remove it as mentioned in the docs: https://docs.fivem.net/events/client-events/#chat-events-resource-events
So once the chat:removeSuggestion
method is called, trying to re-add the same suggestion later basically does nothing as there is a check to avoid adding the same suggestion back (since it was never removed from the this.backingSuggestions
array).
This case prevents being able to set up "context sensitive" suggestions based on some state.
I would recommend one of the following:
- rename the current method to something more akin to what it's currently doing (blacklist?) and add a
chat:removeSuggestion
that would work as described in the docs - change the current method to work as described in the docs
IMHO, I don't think anyone has a need for "blacklisting" a chat command so I would go with the second option.
Let me know what you think.
Happy to make a PR once we agree on something.