Replacements

Information

Here, we explain how to properly replace the following well-known functions to instantly adopt the notifications from our HUD.

Tutorials

Navigate to /fx-server/alpine/opt/cfx-server/citizen/system_resources/monitor/resource and open the file sv_main.lua. Replace the following functions in this file with this code:

TX_EVENT_HANDLERS.announcement = function(eventData)
    if not cvHideAnnouncement then

        -- [UNIQUE_HUD]
        TriggerClientEvent('unique_hud:Announce', -1, "SERVER", eventData.message, 15000) -- Change to your liking.
        -- [UNIQUE_HUD]

        -- TriggerClientEvent('txcl:showAnnouncement', -1, eventData.message, eventData.author) -- Disabled TX Announce.
    end
    TriggerEvent('txsv:logger:addChatMessage', 'tx', '(Broadcast) '..eventData.author, eventData.message)
end

TX_EVENT_HANDLERS.scheduledRestart = function(eventData)
    if not cvHideScheduledRestartWarning then
        
        -- [UNIQUE_HUD]
        TriggerClientEvent('unique_hud:Announce', -1, "SERVER", eventData.translatedMessage, 15000) -- Change to your liking.
        -- [UNIQUE_HUD]

        -- TriggerClientEvent('txcl:showAnnouncement', -1, eventData.translatedMessage, 'txAdmin') -- Disabled TX Announce.
    end
    TriggerEvent('txsv:logger:addChatMessage', 'tx', '(Broadcast) txAdmin', eventData.translatedMessage)
end

Last updated